From 3639d8f2912f7475730ffe299e8834690e6f7e54 Mon Sep 17 00:00:00 2001 From: zerbina <100542850+zerbina@users.noreply.github.com> Date: Sat, 7 Sep 2024 00:59:32 +0000 Subject: [PATCH 1/4] testament: don't join tests with invalid specs If a test's specification is invalid, it must not be joined, so that an error can be reported for it. Previously, a test with an invalid spec could be joined, which effectively discarded the error. The test was also neither run nor compiled, since no targets were enabled for the test, in that case. --- testament/categories.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testament/categories.nim b/testament/categories.nim index b3ebda4f57c..11b8fb635f5 100644 --- a/testament/categories.nim +++ b/testament/categories.nim @@ -319,7 +319,7 @@ proc isJoinableSpec(spec: TSpec, targets: set[TTarget], early: TResultEnum): boo not fileExists(spec.file.changeFileExt("nim.cfg")) and not fileExists(parentDir(spec.file) / "nim.cfg") and spec.cmd.len == 0 and - early notin {reDisabled} and + early notin {reDisabled, reInvalidSpec} and not spec.unjoinable and spec.exitCode == 0 and spec.input.len == 0 and From e792afc7ebecebcf5be1006b97605fc17386b451 Mon Sep 17 00:00:00 2001 From: zerbina <100542850+zerbina@users.noreply.github.com> Date: Sat, 7 Sep 2024 00:59:32 +0000 Subject: [PATCH 2/4] tests: fix the bogus specs --- tests/lang_callable/converter/tconverter_for_static_param.nim | 2 +- tests/lang_callable/macros/tmodify_result_assignment.nim | 2 +- tests/lang_stmts/for_stmt/tfor_ill_formed_sym.nim | 2 +- tests/vm/tconst_seq_crash.nim | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/lang_callable/converter/tconverter_for_static_param.nim b/tests/lang_callable/converter/tconverter_for_static_param.nim index 3b7eaa14e9d..b4e7d8b4847 100644 --- a/tests/lang_callable/converter/tconverter_for_static_param.nim +++ b/tests/lang_callable/converter/tconverter_for_static_param.nim @@ -1,7 +1,7 @@ discard """ description: ''' Ensure that converters are considered for arguments to static parameters - " + ''' """ converter toInt(x: float): int = int(x) diff --git a/tests/lang_callable/macros/tmodify_result_assignment.nim b/tests/lang_callable/macros/tmodify_result_assignment.nim index 2f349c6d33e..58e46012de2 100644 --- a/tests/lang_callable/macros/tmodify_result_assignment.nim +++ b/tests/lang_callable/macros/tmodify_result_assignment.nim @@ -3,7 +3,7 @@ discard """ Partially typed ``nkReturnStmt`` AST is properly re-analyzed after macro invocation ''' - errmsg: "got but expected 'int'" + errormsg: "got but expected 'int'" line: 26 """ diff --git a/tests/lang_stmts/for_stmt/tfor_ill_formed_sym.nim b/tests/lang_stmts/for_stmt/tfor_ill_formed_sym.nim index f30241d736d..55c5ce0e25c 100644 --- a/tests/lang_stmts/for_stmt/tfor_ill_formed_sym.nim +++ b/tests/lang_stmts/for_stmt/tfor_ill_formed_sym.nim @@ -1,6 +1,6 @@ discard """ description: "Ensure that ill-formed AST generates a well formed error" - errmsg: "identifier expected, but found '123'" + errormsg: "identifier expected, but found '123'" """ # This test covers a regression where an error with the symbol outside a pragma diff --git a/tests/vm/tconst_seq_crash.nim b/tests/vm/tconst_seq_crash.nim index c32bcbbe3be..47a337273c3 100644 --- a/tests/vm/tconst_seq_crash.nim +++ b/tests/vm/tconst_seq_crash.nim @@ -4,7 +4,7 @@ discard """ be code evaluated with the compile-time VM ''' target: native - action: compiles + action: compile """ type Obj = object From 6b742c3bf78b935d71e7389cb898e47dbec4e438 Mon Sep 17 00:00:00 2001 From: zerbina <100542850+zerbina@users.noreply.github.com> Date: Sat, 7 Sep 2024 22:34:03 +0000 Subject: [PATCH 3/4] tests: fix `tmodify_result_assignment.nim` The line info of the assignment source expression didn't match the one expected by the test. --- tests/lang_callable/macros/tmodify_result_assignment.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/lang_callable/macros/tmodify_result_assignment.nim b/tests/lang_callable/macros/tmodify_result_assignment.nim index 58e46012de2..06f60cc4fee 100644 --- a/tests/lang_callable/macros/tmodify_result_assignment.nim +++ b/tests/lang_callable/macros/tmodify_result_assignment.nim @@ -19,7 +19,7 @@ macro modify(input: typed) = # replace the right side of the assignment with an expression of different, # incompatible type result.body[0][1] = newStrLitNode("") # wrong type: int vs. string - result.body.copyLineInfo(input.body[0][1]) + result.body[0][1].copyLineInfo(input.body[0][1]) modify: proc p(): int = From d013b885b8627be9f55ab349dd8b37ba5174cb98 Mon Sep 17 00:00:00 2001 From: zerbina <100542850+zerbina@users.noreply.github.com> Date: Sat, 7 Sep 2024 23:40:56 +0000 Subject: [PATCH 4/4] tests: fix `tfor_ill_formed_sym.nim` --- tests/lang_stmts/for_stmt/tfor_ill_formed_sym.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/lang_stmts/for_stmt/tfor_ill_formed_sym.nim b/tests/lang_stmts/for_stmt/tfor_ill_formed_sym.nim index 55c5ce0e25c..219d5d52eaa 100644 --- a/tests/lang_stmts/for_stmt/tfor_ill_formed_sym.nim +++ b/tests/lang_stmts/for_stmt/tfor_ill_formed_sym.nim @@ -1,6 +1,6 @@ discard """ description: "Ensure that ill-formed AST generates a well formed error" - errormsg: "identifier expected, but found '123'" + errormsg: "identifier expected, but found: 123" """ # This test covers a regression where an error with the symbol outside a pragma