it seems like the repl_characterization tests have not been actually running correctly for a while, since tests from more than 2 years ago that should have failed have been in the test suite and OK'd thus far. the reason why some tests passed when they shouldn't have is because the AST nodes used by the characterization parser didn't have a correct comparison operator, so the tests would only fail when one of the output line was of the wrong *kind*, but not if it had the wrong *value*. this was fixed by simply adding a default comparator to the TextNode type as well as every derived class. i've taken the occasion to fix the tests that were failing now that we are actually being strict about them. most of these are pretty boring changes like indentation, but if possible i'd like to get an explicit ACK from at least one or two people on the core team that these changes are okay. for reference, here is the zulip thread that lead to this CL: https://zulip.lix.systems/#narrow/channel/8-Testing-.2F-functional2/topic/.E2.9C.94.20repl-characterization.20tests.20not.20failing/near/10276 ps: i had to turn clang-format off around the macro for text node declarations because it re-formatted the entire macro, causing a lot of noising and producing uglier code; if this isn't okay or if there's a better alternative, please let me know! Change-Id: I1d6d92eb3e9cb705ecfeccd7b9294d6cfd7fe25b
60 lines
1.2 KiB
Plaintext
60 lines
1.2 KiB
Plaintext
nix-repl> 1 + 1
|
|
2
|
|
|
|
nix-repl> :doc builtins.add
|
|
Synopsis: builtins.add e1 e2
|
|
|
|
Return the sum of the numbers e1 and e2.
|
|
|
|
|
|
nix-repl> f = a: "" + a
|
|
|
|
Expect the trace to not contain any traceback:
|
|
|
|
nix-repl> f 2
|
|
error:
|
|
… while evaluating a path segment
|
|
at «string»:1:13:
|
|
1| f = a: "" + a
|
|
| ^
|
|
|
|
error: cannot coerce an integer to a string: 2
|
|
|
|
nix-repl> :te
|
|
showing error traces
|
|
|
|
Expect the trace to have traceback:
|
|
|
|
nix-repl> f 2
|
|
error:
|
|
… from call site
|
|
at «string»:1:1:
|
|
1| f 2
|
|
| ^
|
|
|
|
… while calling anonymous lambda
|
|
at «string»:1:5:
|
|
1| f = a: "" + a
|
|
| ^
|
|
|
|
… while evaluating a path segment
|
|
at «string»:1:13:
|
|
1| f = a: "" + a
|
|
| ^
|
|
|
|
error: cannot coerce an integer to a string: 2
|
|
|
|
Turning it off should also work:
|
|
|
|
nix-repl> :te
|
|
not showing error traces
|
|
|
|
nix-repl> f 2
|
|
error:
|
|
… while evaluating a path segment
|
|
at «string»:1:13:
|
|
1| f = a: "" + a
|
|
| ^
|
|
|
|
error: cannot coerce an integer to a string: 2
|