diff options
Diffstat (limited to 'tests/exception/texcas.nim')
-rw-r--r-- | tests/exception/texcas.nim | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/exception/texcas.nim b/tests/exception/texcas.nim index 4b4ebe448..7108e334c 100644 --- a/tests/exception/texcas.nim +++ b/tests/exception/texcas.nim @@ -1,4 +1,5 @@ discard """ + targets: "c cpp" output: '''Hello Hello ''' @@ -21,5 +22,21 @@ proc test2() = testTemplate(Exception) doAssert(not declared(foobar)) + +proc testTryAsExpr(i: int) = + let x = try: i + except ValueError as ex: + echo(ex.msg) + -1 + test[Exception]() -test2() \ No newline at end of file +test2() +testTryAsExpr(5) + +# see bug #7115 +doAssert(not compiles( + try: + echo 1 + except [KeyError as ex1, ValueError as ex2]: + echo 2 +)) |