You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a function f throws ErrorB, assert.throws(f, ErrorA) and assert.notThrows(f, ErrorA) should signify the actual (ErrorB) and expected (ErrorA) errors rather than just throwing ErrorB
ErrorB is also swallowed as an AssertionError, rather than its true error type. For example, if there is a TypeError inside f, the TypeError message will be thrown as an AssertionError.
constf=function(){constx=5;x=6;}// what currently happens// AssertionError: Assignment to constant variableassert.throws(f,ErrorA);// AssertionError: Got unwanted exceptionassert.notThrows(f,ErrorA);// what should happen// AssertionError: you caught the wrong exception (actual: TypeError, expected: ErrorA)assert.throws(f,ErrorA);// AssertionError: f threw an unwanted exception (actual: TypeError, expected: ErrorA)assert.notThrows(f,ErrorA);
The text was updated successfully, but these errors were encountered:
If a function
f
throwsErrorB
,assert.throws(f, ErrorA)
andassert.notThrows(f, ErrorA)
should signify the actual (ErrorB
) and expected (ErrorA
) errors rather than just throwingErrorB
ErrorB
is also swallowed as anAssertionError
, rather than its true error type. For example, if there is aTypeError
insidef
, theTypeError
message will be thrown as anAssertionError
.The text was updated successfully, but these errors were encountered: