Nim/tests/testament/tshould_not_work.nim
quantimnot 6289b002b6
[Testament] Extend and document message testing aids (#19996)
* [Testament] Extend and document message testing aids

* Enable inline msgs when not reject action.
Eliminates the pain of changing the line and column numbers in `nimout`
or `output` while making changes to the test.
* Enable using inline msgs and nimout together.
Allows ease of inline msgs for the test as well as testing msgs from
other modules.
* Add path separator and test filename variable interpolation in
msgs.
Eases handling path separators in the msgs.
* Add some documentation.

* Fixed lots of broken tests

* Fixed more broken tests

* Support multiple inline messages per a line

* Fix a broken test

* Revert variable substitution in `output`

* Remove uneeded params

* Update doc/testament.md

Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>

* Update testament/specs.nim

Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>

* Update testament/specs.nim

Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>

* Fix indentation

Co-authored-by: quantimnot <quantimnot@users.noreply.github.com>
Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
2022-09-01 17:52:13 +02:00

53 lines
1.4 KiB
Nim

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()