summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorn5m <72841454+n5m@users.noreply.github.com>2020-10-27 07:48:14 +0000
committerGitHub <noreply@github.com>2020-10-27 08:48:14 +0100
commit066f3ebc2ae00af10f477dd9c07b94f1f161030d (patch)
treedab4919f32865ccd32a89cb9e03847d457845872
parent58a1eec96a98adbc3fa36abc8cc770e1a1596443 (diff)
downloadNim-066f3ebc2ae00af10f477dd9c07b94f1f161030d.tar.gz
add tests for Testament "reject" action (#15709)
* add test for reject action

* highlight that a compilation failure is expected

* add the converse test for action=reject

* add trailing newline

* fix wording
-rw-r--r--testament/tests/shouldfail/treject.nim7
-rw-r--r--tests/testament/treject.nim6
-rw-r--r--tests/testament/tshould_not_work.nim2
3 files changed, 15 insertions, 0 deletions
diff --git a/testament/tests/shouldfail/treject.nim b/testament/tests/shouldfail/treject.nim
new file mode 100644
index 000000000..aaf2b4a63
--- /dev/null
+++ b/testament/tests/shouldfail/treject.nim
@@ -0,0 +1,7 @@
+discard """
+action: "reject"
+"""
+
+# Because we set action="reject", we expect this line not to compile. But the
+# line does compile, therefore the test fails.
+assert true
diff --git a/tests/testament/treject.nim b/tests/testament/treject.nim
new file mode 100644
index 000000000..be2db86a9
--- /dev/null
+++ b/tests/testament/treject.nim
@@ -0,0 +1,6 @@
+discard """
+action: "reject"
+"""
+
+# this line does not compile, so the test should pass, since action="reject"
+let x: int = "type mismatch"
diff --git a/tests/testament/tshould_not_work.nim b/tests/testament/tshould_not_work.nim
index 501e2c32f..e4d3c7be7 100644
--- a/tests/testament/tshould_not_work.nim
+++ b/tests/testament/tshould_not_work.nim
@@ -25,6 +25,8 @@ FAIL: tests/shouldfail/toutput.nim C
 Failure: reOutputsDiffer
 FAIL: tests/shouldfail/toutputsub.nim C
 Failure: reOutputsDiffer
+FAIL: tests/shouldfail/treject.nim C
+Failure: reFilesDiffer
 FAIL: tests/shouldfail/tsortoutput.nim C
 Failure: reOutputsDiffer
 FAIL: tests/shouldfail/ttimeout.nim C