diff options
Diffstat (limited to 'tests/cpp/tcppraise.nim')
-rw-r--r-- | tests/cpp/tcppraise.nim | 58 |
1 files changed, 56 insertions, 2 deletions
diff --git a/tests/cpp/tcppraise.nim b/tests/cpp/tcppraise.nim index a9ea8e6ce..f03956d4c 100644 --- a/tests/cpp/tcppraise.nim +++ b/tests/cpp/tcppraise.nim @@ -1,9 +1,14 @@ discard """ - cmd: "nim cpp $file" + targets: "cpp" output: '''foo bar Need odd and >= 3 digits## -baz''' +baz +caught +-------- +Triggered raises2 +Raising ValueError +''' """ # bug #1888 @@ -15,3 +20,52 @@ try: except ValueError: echo getCurrentExceptionMsg(), "##" echo "baz" + + +# bug 7232 +try: + discard +except KeyError, ValueError: + echo "except handler" # should not be invoked + + +#bug 7239 +try: + try: + raise newException(ValueError, "asdf") + except KeyError, ValueError: + raise +except: + echo "caught" + + +# issue 5549 + +var strs: seq[string] = @[] + +try: + discard +finally: + for foobar in strs: + discard + + +# issue #11118 +echo "--------" +proc raises() = + raise newException(ValueError, "Raising ValueError") + +proc raises2() = + try: + raises() + except ValueError as e: + echo "Triggered raises2" + raise e + +try: + raises2() +except: + echo getCurrentExceptionMsg() + discard + +doAssert: getCurrentException() == nil |