I want to demonstrate that Catch[x_] does not catch things thrown with a tag.
Catch[Throw[0, 0]]
gives
Throw::nocatch: Uncaught Throw[0,0] returned to top level.
Hold[Throw[0, 0]]
But I cannot put this behaviour into a VerificationTest that results in Success.
I tried
VerificationTest[Catch[Throw[0, 0]],
Hold[Throw[0, 0]], {Throw::nocatch}, {}]
but this gives an Error TestResultObject.
Usually, using the third argument is the way to go with messages:
VerificationTest[Message[a::b], Null, {a::b}]
I guess I could use something like GeneralUtilities`CatchAll to construct the test manually, but I was under the impression that VerificationTest catches all Error conditions.
Any ideas?
I also seems to require manual work to catch Abort[].
VerificationTest[Abort[], $Aborted]
gives an Error-result too, but the Abort is shielded from the rest of the execution:
VerificationTest[Abort[], $Aborted]*2
does not give $Aborted like Abort[]*2 does.
Catch[ Catch[Throw[0, 0]];, _] =!= Null– Kuba Aug 30 '16 at 13:56