test suite: rename tests containing 'fail' for easier search in logs

This commit is contained in:
Araq 2019-11-25 16:54:43 +01:00 • committed by Andreas Rumpf
commit 80b508d337
6 changed files with 18 additions and 18 deletions

View file

@ -246,7 +246,7 @@ proc `$`(x: TResults): string =
proc addResult(r: var TResults, test: TTest, target: TTarget, proc addResult(r: var TResults, test: TTest, target: TTarget,
expected, given: string, successOrig: TResultEnum) = expected, given: string, successOrig: TResultEnum) =
# test.name is easier to find than test.name.extractFilename # test.name is easier to find than test.name.extractFilename
# A bit hacky but simple and works with tests/testament/tshouldfail.nim # A bit hacky but simple and works with tests/testament/tshould_not_work.nim
var name = test.name.replace(DirSep, '/') var name = test.name.replace(DirSep, '/')
name.add " " & $target & test.options name.add " " & $target & test.options

View file

@ -8,7 +8,7 @@ test5:ok
test6:ok test6:ok
test7:ok test7:ok
-1 -1
tfailedassert.nim tassert2.nim
test8:ok test8:ok
test9:ok test9:ok
test10:ok test10:ok
@ -29,17 +29,17 @@ echo("")
try: try:
doAssert(false, "msg1") # doAssert test doAssert(false, "msg1") # doAssert test
except AssertionError as e: except AssertionError as e:
checkMsg(e.msg, "tfailedassert.nim(30, 11) `false` msg1", "test1") checkMsg(e.msg, "tassert2.nim(30, 11) `false` msg1", "test1")
try: try:
assert false, "msg2" # assert test assert false, "msg2" # assert test
except AssertionError as e: except AssertionError as e:
checkMsg(e.msg, "tfailedassert.nim(35, 10) `false` msg2", "test2") checkMsg(e.msg, "tassert2.nim(35, 10) `false` msg2", "test2")
try: try:
assert false # assert test with no msg assert false # assert test with no msg
except AssertionError as e: except AssertionError as e:
checkMsg(e.msg, "tfailedassert.nim(40, 10) `false` ", "test3") checkMsg(e.msg, "tassert2.nim(40, 10) `false` ", "test3")
try: try:
let a = 1 let a = 1
@ -80,12 +80,12 @@ block:
proc bar: int = proc bar: int =
# local overrides that are active only in this proc # local overrides that are active only in this proc
onFailedAssert(msg): onFailedAssert(msg):
checkMsg(msg, "tfailedassert.nim(85, 11) `false` first assertion from bar", "test6") checkMsg(msg, "tassert2.nim(85, 11) `false` first assertion from bar", "test6")
assert(false, "first assertion from bar") assert(false, "first assertion from bar")
onFailedAssert(msg): onFailedAssert(msg):
checkMsg(msg, "tfailedassert.nim(91, 11) `false` second assertion from bar", "test7") checkMsg(msg, "tassert2.nim(91, 11) `false` second assertion from bar", "test7")
return -1 return -1
assert(false, "second assertion from bar") assert(false, "second assertion from bar")
@ -98,7 +98,7 @@ block:
except: except:
let e = EMyError(getCurrentException()) let e = EMyError(getCurrentException())
echo e.lineinfo.filename echo e.lineinfo.filename
checkMsg(e.msg, "tfailedassert.nim(77, 11) `false` assertion from foo", "test8") checkMsg(e.msg, "tassert2.nim(77, 11) `false` assertion from foo", "test8")
block: ## checks for issue https://github.com/nim-lang/Nim/issues/8518 block: ## checks for issue https://github.com/nim-lang/Nim/issues/8518
template fun(a: string): string = template fun(a: string): string =
@ -109,14 +109,14 @@ block: ## checks for issue https://github.com/nim-lang/Nim/issues/8518
doAssert fun("foo1") == fun("foo2"), "mymsg" doAssert fun("foo1") == fun("foo2"), "mymsg"
except AssertionError as e: except AssertionError as e:
# used to expand out the template instantiaiton, sometimes filling hundreds of lines # used to expand out the template instantiaiton, sometimes filling hundreds of lines
checkMsg(e.msg, """tfailedassert.nim(109, 14) `fun("foo1") == fun("foo2")` mymsg""", "test9") checkMsg(e.msg, """tassert2.nim(109, 14) `fun("foo1") == fun("foo2")` mymsg""", "test9")
block: ## checks for issue https://github.com/nim-lang/Nim/issues/9301 block: ## checks for issue https://github.com/nim-lang/Nim/issues/9301
try: try:
doAssert 1 + 1 == 3 doAssert 1 + 1 == 3
except AssertionError as e: except AssertionError as e:
# used to const fold as false # used to const fold as false
checkMsg(e.msg, "tfailedassert.nim(116, 14) `1 + 1 == 3` ", "test10") checkMsg(e.msg, "tassert2.nim(116, 14) `1 + 1 == 3` ", "test10")
block: ## checks AST isnt' transformed as it used to block: ## checks AST isnt' transformed as it used to
let a = 1 let a = 1
@ -124,4 +124,4 @@ block: ## checks AST isnt' transformed as it used to
doAssert a > 1 doAssert a > 1
except AssertionError as e: except AssertionError as e:
# used to rewrite as `1 < a` # used to rewrite as `1 < a`
checkMsg(e.msg, "tfailedassert.nim(124, 14) `a > 1` ", "test11") checkMsg(e.msg, "tassert2.nim(124, 14) `a > 1` ", "test11")

View file

@ -4,11 +4,11 @@ discard """
""" """
const expected = """ const expected = """
tfailedassert_stacktrace.nim(35) tfailedassert_stacktrace tassert_c.nim(35) tassert_c
tfailedassert_stacktrace.nim(34) foo tassert_c.nim(34) foo
assertions.nim(*) failedAssertImpl assertions.nim(27) failedAssertImpl
assertions.nim(*) raiseAssert assertions.nim(20) raiseAssert
fatal.nim(*) sysFatal""" fatal.nim(39) sysFatal"""
proc tmatch(x, p: string): bool = proc tmatch(x, p: string): bool =
var i = 0 var i = 0

View file

@ -9,12 +9,12 @@ test2:ok
import testhelper import testhelper
onFailedAssert(msg): onFailedAssert(msg):
checkMsg(msg, "tfaileddoassert.nim(15, 9) `a == 2` foo", "test1") checkMsg(msg, "tdoassert.nim(15, 9) `a == 2` foo", "test1")
var a = 1 var a = 1
doAssert(a == 2, "foo") doAssert(a == 2, "foo")
onFailedAssert(msg): onFailedAssert(msg):
checkMsg(msg, "tfaileddoassert.nim(20, 10) `a == 3` ", "test2") checkMsg(msg, "tdoassert.nim(20, 10) `a == 3` ", "test2")
doAssert a == 3 doAssert a == 3