summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2020-05-02 21:16:08 +0200
committerAndreas Rumpf <rumpf_a@web.de>2020-05-02 22:31:19 +0200
commitff1c0bae4c9d375b6f68ab37d3eb24e4e5d15198 (patch)
treedaf98b32fa16d3ab2911ef2bc32614b7f7f7fff0 /tests
parent7f1d2489ad79d09c649e37b6d2db12f5fdbd86d7 (diff)
downloadNim-ff1c0bae4c9d375b6f68ab37d3eb24e4e5d15198.tar.gz
update tests that tested for the 'discard' error messages
Diffstat (limited to 'tests')
-rw-r--r--tests/exprs/texprstmt.nim2
-rw-r--r--tests/exprs/tstmtexp.nim2
-rw-r--r--tests/macros/tmacro6.nim16
-rw-r--r--tests/niminaction/Chapter2/explicit_discard.nim2
-rw-r--r--tests/niminaction/Chapter2/resultreject.nim2
5 files changed, 12 insertions, 12 deletions
diff --git a/tests/exprs/texprstmt.nim b/tests/exprs/texprstmt.nim
index 742670cc1..3c9704650 100644
--- a/tests/exprs/texprstmt.nim
+++ b/tests/exprs/texprstmt.nim
@@ -1,5 +1,5 @@
 discard """
-  errormsg: "expression 'result[1 .. BackwardsIndex(1)]' is of type 'string' and has to be discarded"
+  errormsg: "expression 'result[1 .. BackwardsIndex(1)]' is of type 'string' and has to be used (or discarded)"
   line: 10
 """
 
diff --git a/tests/exprs/tstmtexp.nim b/tests/exprs/tstmtexp.nim
index 75d8dd081..0ae866497 100644
--- a/tests/exprs/tstmtexp.nim
+++ b/tests/exprs/tstmtexp.nim
@@ -1,5 +1,5 @@
 discard """
-  errormsg: "expression '5' is of type 'int literal(5)' and has to be discarded"
+  errormsg: "expression '5' is of type 'int literal(5)' and has to be used (or discarded)"
   file: "tstmtexp.nim"
   line: 8
 """
diff --git a/tests/macros/tmacro6.nim b/tests/macros/tmacro6.nim
index 0b6423100..c65d34b6d 100644
--- a/tests/macros/tmacro6.nim
+++ b/tests/macros/tmacro6.nim
@@ -1,22 +1,22 @@
 discard """
-errormsg: "expression '123' is of type 'int literal(123)' and has to be discarded"
+errormsg: "expression '123' is of type 'int literal(123)' and has to be used (or discarded)"
 line: 71
 """
 
 import macros
 
-proc foo(a,b,c: int): int =
+proc foo(a, b, c: int): int =
   result += a
   result += b
   result += c
 
-macro bar(a,b,c: int): int =
+macro bar(a, b, c: int): int =
   result = newCall(ident"echo")
   result.add a
   result.add b
   result.add c
 
-macro baz(a,b,c: int): int =
+macro baz(a, b, c: int): int =
   let stmt = nnkStmtListExpr.newTree()
   stmt.add newCall(ident"echo", a)
   stmt.add newCall(ident"echo", b)
@@ -26,7 +26,7 @@ macro baz(a,b,c: int): int =
 
 # test no result type with explicit return
 
-macro baz2(a,b,c: int) =
+macro baz2(a, b, c: int) =
   let stmt = nnkStmtListExpr.newTree()
   stmt.add newCall(ident"echo", a)
   stmt.add newCall(ident"echo", b)
@@ -35,7 +35,7 @@ macro baz2(a,b,c: int) =
 
 # test explicit void type with explicit return
 
-macro baz3(a,b,c: int): void =
+macro baz3(a, b, c: int): void =
   let stmt = nnkStmtListExpr.newTree()
   stmt.add newCall(ident"echo", a)
   stmt.add newCall(ident"echo", b)
@@ -44,7 +44,7 @@ macro baz3(a,b,c: int): void =
 
 # test no result type with result variable
 
-macro baz4(a,b,c: int) =
+macro baz4(a, b, c: int) =
   result = nnkStmtListExpr.newTree()
   result.add newCall(ident"echo", a)
   result.add newCall(ident"echo", b)
@@ -52,7 +52,7 @@ macro baz4(a,b,c: int) =
 
 # test explicit void type with result variable
 
-macro baz5(a,b,c: int): void =
+macro baz5(a, b, c: int): void =
   let result = nnkStmtListExpr.newTree()
   result.add newCall(ident"echo", a)
   result.add newCall(ident"echo", b)
diff --git a/tests/niminaction/Chapter2/explicit_discard.nim b/tests/niminaction/Chapter2/explicit_discard.nim
index 9a3b4407e..7f3b3395e 100644
--- a/tests/niminaction/Chapter2/explicit_discard.nim
+++ b/tests/niminaction/Chapter2/explicit_discard.nim
@@ -1,5 +1,5 @@
 discard """
-  errormsg: "has to be discarded"
+  errormsg: "has to be used (or discarded)"
   line: 7
 """
 
diff --git a/tests/niminaction/Chapter2/resultreject.nim b/tests/niminaction/Chapter2/resultreject.nim
index 87c84bf0a..145345072 100644
--- a/tests/niminaction/Chapter2/resultreject.nim
+++ b/tests/niminaction/Chapter2/resultreject.nim
@@ -1,5 +1,5 @@
 discard """
-  errormsg: "has to be discarded"
+  errormsg: "has to be used (or discarded)"
   line: 27
 """