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
It would be useful to be able to assert the Err object and ensure that either no error occurred as expected, or that the expected error was called:
With Suite.Test("calling AcceptsLongsOnly with a long should not raise an error")
On ErrorResume Next
Err.Clear
MyModule.AcceptsLongsOnly 123
.ToNotBeError Err
On ErrorGoTo0End WithWith Suite.Test("calling AcceptsLongsOnly with non-longs should raise an error")
On ErrorResume Next
Err.Clear
MyModule.AcceptsLongsOnly "ABC"
.ToBeError Err, vbObjectError + 10001, "Expected value to be Long."On ErrorGoTo0On ErrorResume Next
Err.Clear
MyModule.AcceptsLongsOnly True
.ToBeError Err, vbObjectError + 10001, "Expected value to be Long."On ErrorGoTo0End With
Of course, the naming of ToNotBeError and ToBeError are only examples. It may be possible to build them into IsOk and NotOk, but I'd prefer a dedicated method with Err or Error in the name for clarity.
The text was updated successfully, but these errors were encountered:
Thanks for the suggestion, I've added IsError and NotError. I tried passing in Err, but it converts it to just the error number when you pass it around, so instead they just check the current global Err.
It would be useful to be able to assert the
Err
object and ensure that either no error occurred as expected, or that the expected error was called:Of course, the naming of
ToNotBeError
andToBeError
are only examples. It may be possible to build them intoIsOk
andNotOk
, but I'd prefer a dedicated method withErr
orError
in the name for clarity.The text was updated successfully, but these errors were encountered: