summary refs log tree commit diff stats
path: root/tests/testament
diff options
context:
space:
mode:
Diffstat (limited to 'tests/testament')
-rw-r--r--tests/testament/t16576.nim7
-rw-r--r--tests/testament/tinlinemsg.nim8
-rw-r--r--tests/testament/tjoinable.nim9
-rw-r--r--tests/testament/treject.nim6
-rw-r--r--tests/testament/tshould_not_work.nim53
-rw-r--r--tests/testament/tspecialpaths.nim9
6 files changed, 92 insertions, 0 deletions
diff --git a/tests/testament/t16576.nim b/tests/testament/t16576.nim
new file mode 100644
index 000000000..8d0dd57e3
--- /dev/null
+++ b/tests/testament/t16576.nim
@@ -0,0 +1,7 @@
+discard """
+  matrix:"-d:nimTest_t16576"
+"""
+
+# bug #16576
+doAssert defined(nimTest_t16576)
+doAssert not defined(nimMegatest)
diff --git a/tests/testament/tinlinemsg.nim b/tests/testament/tinlinemsg.nim
new file mode 100644
index 000000000..199c263e9
--- /dev/null
+++ b/tests/testament/tinlinemsg.nim
@@ -0,0 +1,8 @@
+discard """
+  matrix: "--errorMax:0 --styleCheck:error"
+"""
+
+proc generic_proc*[T](a_a: int) = #[tt.Error
+     ^ 'generic_proc' should be: 'genericProc'; tt.Error
+                      ^ 'a_a' should be: 'aA' ]#
+  discard
diff --git a/tests/testament/tjoinable.nim b/tests/testament/tjoinable.nim
new file mode 100644
index 000000000..c651780de
--- /dev/null
+++ b/tests/testament/tjoinable.nim
@@ -0,0 +1,9 @@
+discard """
+  output: "ok"
+"""
+
+# checks that this is joinable
+# checks that megatest allows duplicate names, see also `tests/misc/tjoinable.nim`
+doAssert defined(testing)
+doAssert defined(nimMegatest)
+echo "ok" # intentional to make sure this doesn't prevent `isJoinableSpec`
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
new file mode 100644
index 000000000..8c99510a0
--- /dev/null
+++ b/tests/testament/tshould_not_work.nim
@@ -0,0 +1,53 @@
+discard """
+  joinable: false
+"""
+
+const expected = """
+FAIL: tests/shouldfail/tccodecheck.nim
+Failure: reCodegenFailure
+Expected:
+baz
+FAIL: tests/shouldfail/tcolumn.nim
+Failure: reLinesDiffer
+FAIL: tests/shouldfail/terrormsg.nim
+Failure: reMsgsDiffer
+FAIL: tests/shouldfail/texitcode1.nim
+Failure: reExitcodesDiffer
+FAIL: tests/shouldfail/tfile.nim
+Failure: reFilesDiffer
+FAIL: tests/shouldfail/tline.nim
+Failure: reLinesDiffer
+FAIL: tests/shouldfail/tmaxcodesize.nim
+Failure: reCodegenFailure
+max allowed size: 1
+FAIL: tests/shouldfail/tnimout.nim
+Failure: reMsgsDiffer
+FAIL: tests/shouldfail/tnimoutfull.nim
+Failure: reMsgsDiffer
+FAIL: tests/shouldfail/toutput.nim
+Failure: reOutputsDiffer
+FAIL: tests/shouldfail/toutputsub.nim
+Failure: reOutputsDiffer
+FAIL: tests/shouldfail/treject.nim
+Failure: reFilesDiffer
+FAIL: tests/shouldfail/tsortoutput.nim
+Failure: reOutputsDiffer
+FAIL: tests/shouldfail/ttimeout.nim
+Failure: reTimeout
+FAIL: tests/shouldfail/tvalgrind.nim
+Failure: reExitcodesDiffer
+"""
+
+import std/[os,strformat,osproc]
+import stdtest/testutils
+
+proc main =
+  const nim = getCurrentCompilerExe()
+  let testamentExe = "bin/testament"
+  let cmd = fmt"{testamentExe} --directory:testament --colors:off --backendLogging:off --nim:{nim} category shouldfail"
+  let (outp, status) = execCmdEx(cmd)
+  doAssert status == 1, $status
+
+  let ok = greedyOrderedSubsetLines(expected, outp, allowPrefixMatch = true)
+  doAssert ok, &"\nexpected:\n{expected}\noutp:\n{outp}"
+main()
diff --git a/tests/testament/tspecialpaths.nim b/tests/testament/tspecialpaths.nim
new file mode 100644
index 000000000..3c97dc88a
--- /dev/null
+++ b/tests/testament/tspecialpaths.nim
@@ -0,0 +1,9 @@
+import stdtest/specialpaths
+import std/os
+block: # splitTestFile
+  doAssert splitTestFile("tests/fakedir/tfakename.nim") == ("fakedir", "tests/fakedir/tfakename.nim".unixToNativePath)
+  doAssert splitTestFile("/pathto/tests/fakedir/tfakename.nim") == ("fakedir", "/pathto/tests/fakedir/tfakename.nim".unixToNativePath)
+  doAssert splitTestFile(getCurrentDir() / "tests/fakedir/tfakename.nim") == ("fakedir", "tests/fakedir/tfakename.nim".unixToNativePath)
+  doAssert splitTestFile(getCurrentDir() / "sub/tests/fakedir/tfakename.nim") == ("fakedir", "sub/tests/fakedir/tfakename.nim".unixToNativePath)
+  doAssertRaises(AssertionDefect): discard splitTestFile("testsbad/fakedir/tfakename.nim")
+  doAssertRaises(AssertionDefect): discard splitTestFile("tests/tfakename.nim")