javascript:try {(valueThrower={valueOf:function(){throw "throw from valueOf"}}, function () { executedRHS = false; var result = 'PASS'; try { result = ++valueThrower; alert('FAIL: Did not throw exception') } catch (e) { if (result != 'PASS' && executedRHS) { alert('FAIL: "'+expr+'" threw exception, but modified assignment target and executed RHS'); } else if (result != 'PASS') { alert('FAIL: "'+expr+'" threw exception, but modified assignment target'); } else if (executedRHS) { alert('FAIL: "'+expr+'" threw exception, but executed right hand half of expression') } else { alert('PASS: handled correctly') } } })()}catch(e){alert("Shouldn't receive: "+e);}
|