summary refs log tree commit diff stats
path: root/tests/effects
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2020-09-10 16:30:20 +0200
committerGitHub <noreply@github.com>2020-09-10 16:30:20 +0200
commit9a110047cbe2826b1d4afe63e3a1f5a08422b73f (patch)
treee73c59654429b359af7bc32bdfdb551859f4556a /tests/effects
parent61c85e034de571cb25020b6dddf662c82896907a (diff)
downloadNim-9a110047cbe2826b1d4afe63e3a1f5a08422b73f.tar.gz
testament improvement: allow inline error messages inside test cases (#15294)
* testament support for inline error messages
* adapt teffects1.nim test to show the potential
Diffstat (limited to 'tests/effects')
-rw-r--r--tests/effects/teffects1.nim19
1 files changed, 9 insertions, 10 deletions
diff --git a/tests/effects/teffects1.nim b/tests/effects/teffects1.nim
index 3bd19f4ab..3551ff1a1 100644
--- a/tests/effects/teffects1.nim
+++ b/tests/effects/teffects1.nim
@@ -1,13 +1,5 @@
 discard """
-  errormsg: "type mismatch: got <proc (x: int): string{.noSideEffect, gcsafe, locks: 0.}> but expected 'MyProcType = proc (x: int): string{.closure.}'"
-  file: "teffects1.nim"
-  line: 38
   cmd: "nim check $file"
-  nimout: '''teffects1.nim(22, 28) template/generic instantiation from here
-teffects1.nim(23, 13) Error: can raise an unlisted exception: ref IOError
-teffects1.nim(22, 29) Hint: 'IO2Error' is declared but not used [XDeclaredButNotUsed]
-teffects1.nim(38, 21) Error: type mismatch: got <proc (x: int): string{.noSideEffect, gcsafe, locks: 0.}> but expected 'MyProcType = proc (x: int): string{.closure.}'
-.raise effects differ'''
 """
 
 type
@@ -20,7 +12,10 @@ type
 proc forw: int {. .}
 
 proc lier(): int {.raises: [IO2Error].} =
-  writeLine stdout, "arg"
+  #[tt.Hint                 ^ 'IO2Error' is declared but not used [XDeclaredButNotUsed] ]#
+  writeLine stdout, "arg" #[tt.Error
+            ^  can raise an unlisted exception: ref IOError
+  ]#
 
 proc forw: int =
   raise newException(IOError, "arg")
@@ -35,5 +30,9 @@ proc foo(x: int): string {.raises: [ValueError].} =
     raise newException(ValueError, "Use single digit")
   $x
 
-var p: MyProcType = foo
+var p: MyProcType = foo #[tt.Error
+                    ^
+type mismatch: got <proc (x: int): string{.noSideEffect, gcsafe, locks: 0.}> but expected 'MyProcType = proc (x: int): string{.closure.}'
+
+]#
 {.pop.}