From de7bef3d24d65f1ad0671d5979843e59bafb22f2 Mon Sep 17 00:00:00 2001 From: flywind Date: Tue, 12 Jan 2021 23:24:41 +0800 Subject: [PATCH 01/18] test PR --- testament/lib/stdtest/testutils.nim | 22 ++++++++++++++++++---- tests/test/test.nim | 10 ++++++++++ 2 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 tests/test/test.nim diff --git a/testament/lib/stdtest/testutils.nim b/testament/lib/stdtest/testutils.nim index 34aa3b751216..29203c3f36b3 100644 --- a/testament/lib/stdtest/testutils.nim +++ b/testament/lib/stdtest/testutils.nim @@ -27,10 +27,24 @@ template flakyAssert*(cond: untyped, msg = "", notifySuccess = true) = proc greedyOrderedSubsetLines*(lhs, rhs: string): bool = ## returns true if each stripped line in `lhs` appears in rhs, using a greedy matching. - let rhs = rhs.strip - var currentPos = 0 + iterator splitLinesClosure(): string {.closure.} = + for line in splitLines(rhs.strip): + yield line + + var rhsIter = splitLinesClosure + + var currentLine = strip(rhsIter()) + + for line in lhs.strip.splitLines: - currentPos = rhs.find(line.strip, currentPos) - if currentPos < 0: + let line = line.strip + if line.len != 0: + while line != currentLine: + currentLine = strip(rhsIter()) + if rhsIter.finished: + return false + + + if rhsIter.finished: return false return true diff --git a/tests/test/test.nim b/tests/test/test.nim new file mode 100644 index 000000000000..dc11cc32f8b5 --- /dev/null +++ b/tests/test/test.nim @@ -0,0 +1,10 @@ +discard """ + nimout: ''' +foobar1 +foobar2 +''' +""" + + +static: echo "foobar1" +static: echo "foobar2" \ No newline at end of file From 89958ad8884aee4df07c4f58792c75d303b1ce7b Mon Sep 17 00:00:00 2001 From: flywind Date: Wed, 13 Jan 2021 16:02:52 +0800 Subject: [PATCH 02/18] better --- testament/lib/stdtest/testutils.nim | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/testament/lib/stdtest/testutils.nim b/testament/lib/stdtest/testutils.nim index 29203c3f36b3..960cf7e986bd 100644 --- a/testament/lib/stdtest/testutils.nim +++ b/testament/lib/stdtest/testutils.nim @@ -27,23 +27,42 @@ template flakyAssert*(cond: untyped, msg = "", notifySuccess = true) = proc greedyOrderedSubsetLines*(lhs, rhs: string): bool = ## returns true if each stripped line in `lhs` appears in rhs, using a greedy matching. - iterator splitLinesClosure(): string {.closure.} = + iterator splitLinesLhs(): string {.closure.} = + for line in splitLines(lhs.strip): + yield line + + var lhsIter = splitLinesLhs + var currentLhs: string = strip(lhsIter()) + + while currentLhs.len == 0 and not lhsIter.finished: + currentLhs = strip(lhsIter()) + + if lhsIter.finished: + return true + + var rhs = rhs + var pos = find(rhs, currentLhs) + if pos < 0: + return false + else: + inc(pos, currentLhs.len) + rhs = rhs[pos .. ^1] + + iterator splitLinesRhs(): string {.closure.} = for line in splitLines(rhs.strip): yield line - var rhsIter = splitLinesClosure + var rhsIter = splitLinesRhs var currentLine = strip(rhsIter()) - - for line in lhs.strip.splitLines: + for line in lhsIter(): let line = line.strip if line.len != 0: while line != currentLine: currentLine = strip(rhsIter()) if rhsIter.finished: return false - if rhsIter.finished: return false From b9bc7a12cbff4eacb8fd25bdf879d7491b2d0c77 Mon Sep 17 00:00:00 2001 From: flywind Date: Wed, 13 Jan 2021 22:18:50 +0800 Subject: [PATCH 03/18] fix dangerous tests --- tests/vm/tcompiletimetable.nim | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/vm/tcompiletimetable.nim b/tests/vm/tcompiletimetable.nim index ece2ddfe90d8..1db490f1ab76 100644 --- a/tests/vm/tcompiletimetable.nim +++ b/tests/vm/tcompiletimetable.nim @@ -1,12 +1,16 @@ discard """ - nimout: '''2 + nimout: ''' +2 3 4:2 Got Hi Got Hey +''' + output:''' a b -c''' +c +''' """ # bug #404 From 56317052260a857ead52c86d88773a517cd96db1 Mon Sep 17 00:00:00 2001 From: flywind Date: Wed, 13 Jan 2021 22:44:50 +0800 Subject: [PATCH 04/18] fix annoying dots --- tests/vm/tmisc_vm.nim | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/vm/tmisc_vm.nim b/tests/vm/tmisc_vm.nim index 2d3e30c5e53b..bbf618622d4a 100644 --- a/tests/vm/tmisc_vm.nim +++ b/tests/vm/tmisc_vm.nim @@ -19,6 +19,7 @@ foo4 (a: 0, b: 0) ''' """ +import std/sets #bug #1009 type @@ -95,8 +96,6 @@ static: simpleTryFinally() # bug #10981 -import sets - proc main = for i in 0..<15: var someSets = @[initHashSet[int]()] From 35f83d420d9123582ac329cda1ad9cbcaa156e22 Mon Sep 17 00:00:00 2001 From: flywind Date: Wed, 13 Jan 2021 23:30:22 +0800 Subject: [PATCH 05/18] fix --- tests/testament/tshould_not_work.nim | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/testament/tshould_not_work.nim b/tests/testament/tshould_not_work.nim index a0b4d6a36779..9c81cdd604aa 100644 --- a/tests/testament/tshould_not_work.nim +++ b/tests/testament/tshould_not_work.nim @@ -1,5 +1,6 @@ discard """ cmd: "testament/testament --directory:testament --colors:off --backendLogging:off --nim:$nim category shouldfail" +targets: "c" action: compile nimout: ''' FAIL: tests/shouldfail/tccodecheck.nim c From 1783ccce28bf965e02b618a2f1b960f70a7f8aab Mon Sep 17 00:00:00 2001 From: flywind Date: Thu, 14 Jan 2021 22:46:31 +0800 Subject: [PATCH 06/18] go --- testament/lib/stdtest/testutils.nim | 30 ++++------------------------- tests/test/test.nim | 10 ---------- 2 files changed, 4 insertions(+), 36 deletions(-) delete mode 100644 tests/test/test.nim diff --git a/testament/lib/stdtest/testutils.nim b/testament/lib/stdtest/testutils.nim index 960cf7e986bd..9971f6f9c796 100644 --- a/testament/lib/stdtest/testutils.nim +++ b/testament/lib/stdtest/testutils.nim @@ -26,37 +26,15 @@ template flakyAssert*(cond: untyped, msg = "", notifySuccess = true) = echo msg2 proc greedyOrderedSubsetLines*(lhs, rhs: string): bool = - ## returns true if each stripped line in `lhs` appears in rhs, using a greedy matching. - iterator splitLinesLhs(): string {.closure.} = - for line in splitLines(lhs.strip): - yield line - - var lhsIter = splitLinesLhs - var currentLhs: string = strip(lhsIter()) - - while currentLhs.len == 0 and not lhsIter.finished: - currentLhs = strip(lhsIter()) - - if lhsIter.finished: - return true - - var rhs = rhs - var pos = find(rhs, currentLhs) - if pos < 0: - return false - else: - inc(pos, currentLhs.len) - rhs = rhs[pos .. ^1] - - iterator splitLinesRhs(): string {.closure.} = + ## Returns true if each stripped line in `lhs` appears in rhs, using a greedy matching. + iterator splitLinesClosure(): string {.closure.} = for line in splitLines(rhs.strip): yield line - var rhsIter = splitLinesRhs - + var rhsIter = splitLinesClosure var currentLine = strip(rhsIter()) - for line in lhsIter(): + for line in lhs.strip.splitLines: let line = line.strip if line.len != 0: while line != currentLine: diff --git a/tests/test/test.nim b/tests/test/test.nim deleted file mode 100644 index dc11cc32f8b5..000000000000 --- a/tests/test/test.nim +++ /dev/null @@ -1,10 +0,0 @@ -discard """ - nimout: ''' -foobar1 -foobar2 -''' -""" - - -static: echo "foobar1" -static: echo "foobar2" \ No newline at end of file From cedfd9f3877e93e86a506200e8a9e1ca4b8178d9 Mon Sep 17 00:00:00 2001 From: flywind Date: Thu, 14 Jan 2021 23:19:09 +0800 Subject: [PATCH 07/18] fix --- tests/compilerfeatures/texpandmacro.nim | 2 +- tests/errmsgs/tgcsafety.nim | 2 +- tests/errmsgs/twrongcolon.nim | 2 +- tests/exprs/tresultwarning.nim | 2 +- tests/init/tuninit1.nim | 2 +- tests/objvariant/tcheckedfield1.nim | 2 +- tests/varres/tprevent_forloopvar_mutations.nim | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/compilerfeatures/texpandmacro.nim b/tests/compilerfeatures/texpandmacro.nim index 76b0263ae3d1..fea8b571fbf1 100644 --- a/tests/compilerfeatures/texpandmacro.nim +++ b/tests/compilerfeatures/texpandmacro.nim @@ -1,6 +1,6 @@ discard """ cmd: "nim c --expandMacro:foo $file" - nimout: '''Hint: expanded macro: + nimout: '''texpandmacro.nim(17, 1) Hint: expanded macro: echo ["injected echo"] var x = 4 [ExpandMacro] ''' diff --git a/tests/errmsgs/tgcsafety.nim b/tests/errmsgs/tgcsafety.nim index 77515b74fa46..09ef92e752c2 100644 --- a/tests/errmsgs/tgcsafety.nim +++ b/tests/errmsgs/tgcsafety.nim @@ -2,7 +2,7 @@ discard """ cmd: "nim check $file" errormsg: "type mismatch: got .}>" nimout: ''' -type mismatch: got .}> +tgcsafety.nim(30, 18) Error: type mismatch: got .}> but expected one of: proc serve(server: AsyncHttpServer; port: Port; callback: proc (request: Request): Future[void] {.closure, gcsafe.}; diff --git a/tests/errmsgs/twrongcolon.nim b/tests/errmsgs/twrongcolon.nim index e59e37660f56..070fd009b870 100644 --- a/tests/errmsgs/twrongcolon.nim +++ b/tests/errmsgs/twrongcolon.nim @@ -1,7 +1,7 @@ discard """ errormsg: "in expression ':" nimout: ''' -Error: in expression ': +twrongcolon.nim(11, 12) Error: in expression ': 890': identifier expected, but found '' ''' diff --git a/tests/exprs/tresultwarning.nim b/tests/exprs/tresultwarning.nim index 32934408eac7..28dabfdb1e9e 100644 --- a/tests/exprs/tresultwarning.nim +++ b/tests/exprs/tresultwarning.nim @@ -1,5 +1,5 @@ discard """ - nimout: "Special variable 'result' is shadowed. [ResultShadowed]" + nimout: "tresultwarning.nim(6, 7) Warning: Special variable 'result' is shadowed. [ResultShadowed]" """ proc test(): string = diff --git a/tests/init/tuninit1.nim b/tests/init/tuninit1.nim index fe91733ffc3a..b281bcf894cb 100644 --- a/tests/init/tuninit1.nim +++ b/tests/init/tuninit1.nim @@ -1,5 +1,5 @@ discard """ - nimout: "Warning: use explicit initialization of 'y' for clarity [Uninit]" + nimout: "tuninit1.nim(35, 11) Warning: use explicit initialization of 'y' for clarity [Uninit]" line:34 action: compile """ diff --git a/tests/objvariant/tcheckedfield1.nim b/tests/objvariant/tcheckedfield1.nim index 69b099f24dc0..e1a2e60e612f 100644 --- a/tests/objvariant/tcheckedfield1.nim +++ b/tests/objvariant/tcheckedfield1.nim @@ -1,5 +1,5 @@ discard """ - nimout: "Warning: cannot prove that field 'x.s' is accessible [ProveField]" + nimout: "tcheckedfield1.nim(40, 6) Warning: cannot prove that field 'x.s' is accessible [ProveField]" line:51 action: run output: "abc abc" diff --git a/tests/varres/tprevent_forloopvar_mutations.nim b/tests/varres/tprevent_forloopvar_mutations.nim index 15f31d8a3462..045dc7cbb660 100644 --- a/tests/varres/tprevent_forloopvar_mutations.nim +++ b/tests/varres/tprevent_forloopvar_mutations.nim @@ -1,7 +1,7 @@ discard """ errormsg: "type mismatch: got " line: 17 - nimout: '''type mismatch: got + nimout: '''tprevent_forloopvar_mutations.nim(17, 7) Error: type mismatch: got but expected one of: proc inc[T: Ordinal](x: var T; y = 1) first type mismatch at position: 1 From dc5814732f61da8ea8142079b8d8e7e14a9f7aa3 Mon Sep 17 00:00:00 2001 From: flywind Date: Fri, 15 Jan 2021 10:55:45 +0800 Subject: [PATCH 08/18] go --- tests/pragmas/thintprocess.nim | 16 ++++++++++++++++ tests/pragmas/twarning_off.nim | 1 - 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 tests/pragmas/thintprocess.nim diff --git a/tests/pragmas/thintprocess.nim b/tests/pragmas/thintprocess.nim new file mode 100644 index 000000000000..2b63fd40cbc4 --- /dev/null +++ b/tests/pragmas/thintprocess.nim @@ -0,0 +1,16 @@ +discard """ + matrix: "--hint:processing" + nimout: ''' +.. +warn_module.nim(6, 6) Hint: 'test' is declared but not used [XDeclaredButNotUsed] +compile end +''' +""" + +static: + echo "compile start" + +import warn_module + +static: + echo "compile end" \ No newline at end of file diff --git a/tests/pragmas/twarning_off.nim b/tests/pragmas/twarning_off.nim index bada2999b490..d5d31d4c2356 100644 --- a/tests/pragmas/twarning_off.nim +++ b/tests/pragmas/twarning_off.nim @@ -1,5 +1,4 @@ discard """ - matrix: "--hint:processing" nimout: ''' compile start .. From 0993b55c4919fd40f4daa81d7ba8058a9836ebe5 Mon Sep 17 00:00:00 2001 From: flywind Date: Sat, 3 Apr 2021 19:27:29 +0800 Subject: [PATCH 09/18] fix --- testament/lib/stdtest/testutils.nim | 38 +++++++++++++++-------------- tests/pragmas/twarning_off.nim | 1 - tests/stdlib/tcstring.nim | 2 +- tests/stdlib/ttestutils.nim | 3 +++ 4 files changed, 24 insertions(+), 20 deletions(-) diff --git a/testament/lib/stdtest/testutils.nim b/testament/lib/stdtest/testutils.nim index 05e4d35f9e22..58d136696d2f 100644 --- a/testament/lib/stdtest/testutils.nim +++ b/testament/lib/stdtest/testutils.nim @@ -1,5 +1,4 @@ import std/private/miscdollars -import std/strutils from std/os import getEnv template flakyAssert*(cond: untyped, msg = "", notifySuccess = true) = @@ -26,26 +25,29 @@ template flakyAssert*(cond: untyped, msg = "", notifySuccess = true) = msg2.add $expr & " " & msg echo msg2 -proc greedyOrderedSubsetLines*(lhs, rhs: string): bool = - ## Returns true if each stripped line in `lhs` appears in rhs, using a greedy matching. - iterator splitLinesClosure(): string {.closure.} = - for line in splitLines(rhs.strip): - yield line +when not defined(js): + import std/strutils - var rhsIter = splitLinesClosure - var currentLine = strip(rhsIter()) + proc greedyOrderedSubsetLines*(lhs, rhs: string): bool = + ## Returns true if each stripped line in `lhs` appears in rhs, using a greedy matching. + iterator splitLinesClosure(): string {.closure.} = + for line in splitLines(rhs.strip): + yield line - for line in lhs.strip.splitLines: - let line = line.strip - if line.len != 0: - while line != currentLine: - currentLine = strip(rhsIter()) - if rhsIter.finished: - return false + var rhsIter = splitLinesClosure + var currentLine = strip(rhsIter()) - if rhsIter.finished: - return false - return true + for line in lhs.strip.splitLines: + let line = line.strip + if line.len != 0: + while line != currentLine: + currentLine = strip(rhsIter()) + if rhsIter.finished: + return false + + if rhsIter.finished: + return false + return true template enableRemoteNetworking*: bool = ## Allows contolling whether to run some test at a statement-level granularity. diff --git a/tests/pragmas/twarning_off.nim b/tests/pragmas/twarning_off.nim index d5d31d4c2356..ccf07b9c4651 100644 --- a/tests/pragmas/twarning_off.nim +++ b/tests/pragmas/twarning_off.nim @@ -1,7 +1,6 @@ discard """ nimout: ''' compile start -.. warn_module.nim(6, 6) Hint: 'test' is declared but not used [XDeclaredButNotUsed] compile end ''' diff --git a/tests/stdlib/tcstring.nim b/tests/stdlib/tcstring.nim index 98da5d5c4df2..04a26b53cb51 100644 --- a/tests/stdlib/tcstring.nim +++ b/tests/stdlib/tcstring.nim @@ -1,6 +1,6 @@ discard """ targets: "c cpp js" - matrix: "; --gc:arc" + matrix: "--gc:refc; --gc:arc" """ from std/sugar import collect diff --git a/tests/stdlib/ttestutils.nim b/tests/stdlib/ttestutils.nim index 1a50d311b84d..4d77d471bb34 100644 --- a/tests/stdlib/ttestutils.nim +++ b/tests/stdlib/ttestutils.nim @@ -4,3 +4,6 @@ block: # greedyOrderedSubsetLines doAssert greedyOrderedSubsetLines("a1\na3", "a0\na1\na2\na3\na4") doAssert not greedyOrderedSubsetLines("a3\na1", "a0\na1\na2\na3\na4") # out of order doAssert not greedyOrderedSubsetLines("a1\na5", "a0\na1\na2\na3\na4") # a5 not in lhs + + doAssert not greedyOrderedSubsetLines("a1\na5", "a0\na1\na2\na3\na4\nprefix:a5") + doAssert not greedyOrderedSubsetLines("a1\na5", "a0\na1\na2\na3\na4\na5:suffix") From 3cc23115377dc082863d528f2acd3060db70dd5d Mon Sep 17 00:00:00 2001 From: flywind Date: Sat, 3 Apr 2021 20:05:09 +0800 Subject: [PATCH 10/18] fix --- testament/tests/shouldfail/tccodecheck.nim | 3 ++- testament/tests/shouldfail/tcolumn.nim | 7 ++++--- testament/tests/shouldfail/terrormsg.nim | 7 ++++--- testament/tests/shouldfail/texitcode1.nim | 3 ++- testament/tests/shouldfail/tfile.nim | 5 +++-- testament/tests/shouldfail/tline.nim | 7 ++++--- testament/tests/shouldfail/tmaxcodesize.nim | 3 ++- testament/tests/shouldfail/tnimout.nim | 5 +++-- testament/tests/shouldfail/toutput.nim | 7 ++++--- testament/tests/shouldfail/toutputsub.nim | 3 ++- testament/tests/shouldfail/treject.nim | 3 ++- testament/tests/shouldfail/tsortoutput.nim | 11 ++++++----- testament/tests/shouldfail/ttimeout.nim | 1 + testament/tests/shouldfail/tvalgrind.nim | 5 +++-- 14 files changed, 42 insertions(+), 28 deletions(-) diff --git a/testament/tests/shouldfail/tccodecheck.nim b/testament/tests/shouldfail/tccodecheck.nim index a8d216a5b24f..7b5f0cce682d 100644 --- a/testament/tests/shouldfail/tccodecheck.nim +++ b/testament/tests/shouldfail/tccodecheck.nim @@ -1,5 +1,6 @@ discard """ -ccodecheck: "baz" + targets: "c" + ccodecheck: "baz" """ proc foo(): void {.exportc: "bar".}= diff --git a/testament/tests/shouldfail/tcolumn.nim b/testament/tests/shouldfail/tcolumn.nim index 89482e673944..b79ec52a45eb 100644 --- a/testament/tests/shouldfail/tcolumn.nim +++ b/testament/tests/shouldfail/tcolumn.nim @@ -1,7 +1,8 @@ discard """ -errormsg: "undeclared identifier: 'undeclared'" -line: 8 -column: 7 + errormsg: "undeclared identifier: 'undeclared'" + targets: "c" + line: 9 + column: 7 """ # test should fail because the line directive is wrong diff --git a/testament/tests/shouldfail/terrormsg.nim b/testament/tests/shouldfail/terrormsg.nim index dbbdf5021c54..e690352357c7 100644 --- a/testament/tests/shouldfail/terrormsg.nim +++ b/testament/tests/shouldfail/terrormsg.nim @@ -1,7 +1,8 @@ discard """ -errormsg: "wrong error message" -line: 8 -column: 6 + errormsg: "wrong error message" + targets: "c" + line: 9 + column: 6 """ # test should fail because the line directive is wrong diff --git a/testament/tests/shouldfail/texitcode1.nim b/testament/tests/shouldfail/texitcode1.nim index 1b38b4f2e2e6..e5e06157831c 100644 --- a/testament/tests/shouldfail/texitcode1.nim +++ b/testament/tests/shouldfail/texitcode1.nim @@ -1,3 +1,4 @@ discard """ -exitcode: 1 + targets: "c" + exitcode: 1 """ diff --git a/testament/tests/shouldfail/tfile.nim b/testament/tests/shouldfail/tfile.nim index 20d4bd1f3490..9463882f9b90 100644 --- a/testament/tests/shouldfail/tfile.nim +++ b/testament/tests/shouldfail/tfile.nim @@ -1,6 +1,7 @@ discard """ -errormsg: "undeclared identifier: 'undefined'" -file: "notthisfile.nim" + targets: "c" + errormsg: "undeclared identifier: 'undefined'" + file: "notthisfile.nim" """ echo undefined diff --git a/testament/tests/shouldfail/tline.nim b/testament/tests/shouldfail/tline.nim index f7a09875c569..7f7e90896d2d 100644 --- a/testament/tests/shouldfail/tline.nim +++ b/testament/tests/shouldfail/tline.nim @@ -1,7 +1,8 @@ discard """ -errormsg: "undeclared identifier: 'undeclared'" -line: 9 -column: 6 + targets: "c" + errormsg: "undeclared identifier: 'undeclared'" + line: 10 + column: 6 """ # test should fail because the line directive is wrong diff --git a/testament/tests/shouldfail/tmaxcodesize.nim b/testament/tests/shouldfail/tmaxcodesize.nim index 9879e418147d..9e2bd9cfb448 100644 --- a/testament/tests/shouldfail/tmaxcodesize.nim +++ b/testament/tests/shouldfail/tmaxcodesize.nim @@ -1,5 +1,6 @@ discard """ -maxcodesize: 1 + targets: "c" + maxcodesize: 1 """ echo "Hello World" diff --git a/testament/tests/shouldfail/tnimout.nim b/testament/tests/shouldfail/tnimout.nim index c0e332053159..832f134b0afd 100644 --- a/testament/tests/shouldfail/tnimout.nim +++ b/testament/tests/shouldfail/tnimout.nim @@ -1,6 +1,7 @@ discard """ -nimout: "Hello World!" -action: compile + targets: "c" + nimout: "Hello World!" + action: compile """ static: diff --git a/testament/tests/shouldfail/toutput.nim b/testament/tests/shouldfail/toutput.nim index ac0bc7a46b8c..0fa4d7278383 100644 --- a/testament/tests/shouldfail/toutput.nim +++ b/testament/tests/shouldfail/toutput.nim @@ -1,7 +1,8 @@ discard """ -output: ''' -done -''' + targets: "c" + output: ''' + done + ''' """ echo "broken" diff --git a/testament/tests/shouldfail/toutputsub.nim b/testament/tests/shouldfail/toutputsub.nim index 7cc51ee8d677..b34f3a8f2c28 100644 --- a/testament/tests/shouldfail/toutputsub.nim +++ b/testament/tests/shouldfail/toutputsub.nim @@ -1,5 +1,6 @@ discard """ -outputsub: "something else" + outputsub: "something else" + targets: "c" """ echo "Hello World!" diff --git a/testament/tests/shouldfail/treject.nim b/testament/tests/shouldfail/treject.nim index aaf2b4a63c89..395dc425113e 100644 --- a/testament/tests/shouldfail/treject.nim +++ b/testament/tests/shouldfail/treject.nim @@ -1,5 +1,6 @@ discard """ -action: "reject" + action: "reject" + targets: "c" """ # Because we set action="reject", we expect this line not to compile. But the diff --git a/testament/tests/shouldfail/tsortoutput.nim b/testament/tests/shouldfail/tsortoutput.nim index 4ce9ce26d816..0c165d21b334 100644 --- a/testament/tests/shouldfail/tsortoutput.nim +++ b/testament/tests/shouldfail/tsortoutput.nim @@ -1,9 +1,10 @@ discard """ -sortoutput: true -output: ''' -2 -1 -''' + sortoutput: true + targets: "c" + output: ''' + 2 + 1 + ''' """ # this test should ensure that the output is actually sorted diff --git a/testament/tests/shouldfail/ttimeout.nim b/testament/tests/shouldfail/ttimeout.nim index fd3e1a598a2f..8ffd71aaadf3 100644 --- a/testament/tests/shouldfail/ttimeout.nim +++ b/testament/tests/shouldfail/ttimeout.nim @@ -1,5 +1,6 @@ discard """ timeout: "0.1" + targets: "c" """ import os diff --git a/testament/tests/shouldfail/tvalgrind.nim b/testament/tests/shouldfail/tvalgrind.nim index 4f699fd3b942..5502705b3ce7 100644 --- a/testament/tests/shouldfail/tvalgrind.nim +++ b/testament/tests/shouldfail/tvalgrind.nim @@ -1,6 +1,7 @@ discard """ -valgrind: true -cmd: "nim $target --gc:arc -d:useMalloc $options $file" + valgrind: true + targets: "c" + cmd: "nim $target --gc:arc -d:useMalloc $options $file" """ # this is the same check used by testament/specs.nim whether or not valgrind From 5722b675638681613c017acf94b730d038f6ef4b Mon Sep 17 00:00:00 2001 From: flywind Date: Sun, 4 Apr 2021 10:17:41 +0800 Subject: [PATCH 11/18] Update twrongcolon.nim --- tests/errmsgs/twrongcolon.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/errmsgs/twrongcolon.nim b/tests/errmsgs/twrongcolon.nim index 837315f8defc..22c59dd72030 100644 --- a/tests/errmsgs/twrongcolon.nim +++ b/tests/errmsgs/twrongcolon.nim @@ -4,7 +4,7 @@ nimout: ''' 890': identifier expected, but found '' ''' -line: 11 +line: 10 """ var n: int : 890 From 3155d9b5ae2dab86859e6a1deafb66f53bf79634 Mon Sep 17 00:00:00 2001 From: flywind Date: Sun, 4 Apr 2021 10:22:37 +0800 Subject: [PATCH 12/18] Update twrongcolon.nim --- tests/errmsgs/twrongcolon.nim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/errmsgs/twrongcolon.nim b/tests/errmsgs/twrongcolon.nim index 22c59dd72030..f4f996c3e318 100644 --- a/tests/errmsgs/twrongcolon.nim +++ b/tests/errmsgs/twrongcolon.nim @@ -1,10 +1,11 @@ discard """ errormsg: "in expression ' do:" nimout: ''' +Error: in expression ' do: 890': identifier expected, but found '' ''' -line: 10 +line: 11 """ var n: int : 890 From 6d514bfd3e403f29980542cc4b4cc18cc312f748 Mon Sep 17 00:00:00 2001 From: flywind Date: Sun, 4 Apr 2021 10:27:25 +0800 Subject: [PATCH 13/18] Update tshould_not_work.nim --- tests/testament/tshould_not_work.nim | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/testament/tshould_not_work.nim b/tests/testament/tshould_not_work.nim index 9c81cdd604aa..a0b4d6a36779 100644 --- a/tests/testament/tshould_not_work.nim +++ b/tests/testament/tshould_not_work.nim @@ -1,6 +1,5 @@ discard """ cmd: "testament/testament --directory:testament --colors:off --backendLogging:off --nim:$nim category shouldfail" -targets: "c" action: compile nimout: ''' FAIL: tests/shouldfail/tccodecheck.nim c From 9137f920731ba5d015ebf80d3d3ca76dbd1dad9f Mon Sep 17 00:00:00 2001 From: flywind Date: Sun, 4 Apr 2021 10:54:22 +0800 Subject: [PATCH 14/18] Update twrongcolon.nim --- tests/errmsgs/twrongcolon.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/errmsgs/twrongcolon.nim b/tests/errmsgs/twrongcolon.nim index f4f996c3e318..20063cbc4b59 100644 --- a/tests/errmsgs/twrongcolon.nim +++ b/tests/errmsgs/twrongcolon.nim @@ -1,7 +1,7 @@ discard """ errormsg: "in expression ' do:" nimout: ''' -Error: in expression ' do: +twrongcolon.nim(11, 12) Error: in expression ' do: 890': identifier expected, but found '' ''' From f69e9e8430bcb0c4a88015ca6667ef39daa9d128 Mon Sep 17 00:00:00 2001 From: flywind Date: Sun, 4 Apr 2021 17:01:41 +0800 Subject: [PATCH 15/18] Update tests/stdlib/ttestutils.nim Co-authored-by: Timothee Cour --- tests/stdlib/ttestutils.nim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/stdlib/ttestutils.nim b/tests/stdlib/ttestutils.nim index 4d77d471bb34..7e39c9ae38cc 100644 --- a/tests/stdlib/ttestutils.nim +++ b/tests/stdlib/ttestutils.nim @@ -7,3 +7,5 @@ block: # greedyOrderedSubsetLines doAssert not greedyOrderedSubsetLines("a1\na5", "a0\na1\na2\na3\na4\nprefix:a5") doAssert not greedyOrderedSubsetLines("a1\na5", "a0\na1\na2\na3\na4\na5:suffix") + doAssert not greedyOrderedSubsetLines("a5", "a0\na1\na2\na3\na4\nprefix:a5") + doAssert not greedyOrderedSubsetLines("a5", "a0\na1\na2\na3\na4\na5:suffix") From ec9c2573f1318484742a4c18cee32276794096f7 Mon Sep 17 00:00:00 2001 From: flywind Date: Sun, 4 Apr 2021 17:02:40 +0800 Subject: [PATCH 16/18] Rename thintprocess.nim to thintprocessing.nim --- tests/pragmas/{thintprocess.nim => thintprocessing.nim} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename tests/pragmas/{thintprocess.nim => thintprocessing.nim} (91%) diff --git a/tests/pragmas/thintprocess.nim b/tests/pragmas/thintprocessing.nim similarity index 91% rename from tests/pragmas/thintprocess.nim rename to tests/pragmas/thintprocessing.nim index 2b63fd40cbc4..45a5be1ed51b 100644 --- a/tests/pragmas/thintprocess.nim +++ b/tests/pragmas/thintprocessing.nim @@ -13,4 +13,4 @@ static: import warn_module static: - echo "compile end" \ No newline at end of file + echo "compile end" From b474044bf6b825adc47e65be0bb1ab7a188c060c Mon Sep 17 00:00:00 2001 From: flywind Date: Sun, 4 Apr 2021 17:05:50 +0800 Subject: [PATCH 17/18] Update tests/pragmas/thintprocessing.nim --- tests/pragmas/thintprocessing.nim | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/pragmas/thintprocessing.nim b/tests/pragmas/thintprocessing.nim index 45a5be1ed51b..bada2999b490 100644 --- a/tests/pragmas/thintprocessing.nim +++ b/tests/pragmas/thintprocessing.nim @@ -1,6 +1,7 @@ discard """ matrix: "--hint:processing" nimout: ''' +compile start .. warn_module.nim(6, 6) Hint: 'test' is declared but not used [XDeclaredButNotUsed] compile end From e11cb3158d79c8757cac8ea2017ce3c0e5027f82 Mon Sep 17 00:00:00 2001 From: flywind Date: Sun, 4 Apr 2021 17:57:56 +0800 Subject: [PATCH 18/18] Update tests/pragmas/thintprocessing.nim --- tests/pragmas/thintprocessing.nim | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/pragmas/thintprocessing.nim b/tests/pragmas/thintprocessing.nim index bada2999b490..c608bc6e42b9 100644 --- a/tests/pragmas/thintprocessing.nim +++ b/tests/pragmas/thintprocessing.nim @@ -1,4 +1,5 @@ discard """ + disabled: windows matrix: "--hint:processing" nimout: ''' compile start