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
113 lines
3.9 KiB
Plaintext
113 lines
3.9 KiB
Plaintext
@args --debugger
|
|
|
|
:c at the root repl is not allowed since no debugger is running yet
|
|
nix-repl> :c
|
|
error: command 'c' can only be used when the debugger is active
|
|
|
|
:c and other commands become available once a debugger starts
|
|
nix-repl> with {}; a
|
|
error: undefined variable 'a'
|
|
at «string»:1:10:
|
|
1| with {}; a
|
|
| ^
|
|
|
|
nix-repl> :?
|
|
The following commands are available:
|
|
|
|
<expr> Evaluate and print expression
|
|
<x> = <expr> Bind expression to variable
|
|
:?, :help Print help about all commands (this content)
|
|
:a, :add <expr> Add attributes from resulting set to scope
|
|
:b, :build <expr> Build a derivation
|
|
:bl, :build-with-gc-roots <expr> Build a derivation, creating GC roots in the working directory
|
|
:doc <expr> Show documentation for the provided function (experimental lambda support)
|
|
:e, :edit <expr> Open package or function in $EDITOR
|
|
:env Show environment stack
|
|
:i, :build-and-install <expr> Build derivation, then install result into current profile
|
|
:l, :load <path> Load Nix expression and add it to scope
|
|
:log <expr | .drv path> Show logs for a derivation
|
|
:p, :print <expr> Evaluate and print expression recursively
|
|
Strings are printed directly, without escaping.
|
|
:q, :quit Exit the REPL
|
|
:r, :reload Reload all files successfully loaded
|
|
:sh, :shell <expr> Build dependencies of derivation, then start nix-shell
|
|
:t, :type <expr> Describe result of evaluation
|
|
:te, :trace-enable [bool] Enable, disable, or toggle showing traces for errors
|
|
:u, :use <expr> Build derivation, then start nix-shell
|
|
|
|
Debug mode commands
|
|
|
|
:bt, :backtrace Show trace stack
|
|
:c, :continue Go until end of program, exception or builtins.break
|
|
:s, :step Go one step
|
|
:st, :show-trace [integer index] Show current trace. If an integer is provided, this switches to that stack beforehand. If the integer has an explicit + or - sign, it is treated as relative to the current stack index.
|
|
|
|
Flakes commands
|
|
|
|
:lf, :load-flake <flakeref> Load Nix flake and add it to the scope
|
|
|
|
we can now inspect state
|
|
nix-repl> :bt
|
|
0: error: undefined variable 'a'
|
|
«string»:1:10
|
|
|
|
1| with {}; a
|
|
| ^
|
|
|
|
1: error: Fake frame for debugging purposes
|
|
«string»:1:10
|
|
|
|
1| with {}; a
|
|
| ^
|
|
|
|
and resume execution
|
|
nix-repl> :c
|
|
error: undefined variable 'a'
|
|
at «string»:1:10:
|
|
1| with {}; a
|
|
| ^
|
|
|
|
the debugger is once again disabled
|
|
nix-repl> :c
|
|
error: command 'c' can only be used when the debugger is active
|
|
|
|
leaving the debugger from a toplevel error and entering it again doesn't leave old frames visible
|
|
nix-repl> with {}; a
|
|
error: undefined variable 'a'
|
|
at «string»:1:10:
|
|
1| with {}; a
|
|
| ^
|
|
|
|
nix-repl> :s
|
|
error: undefined variable 'a'
|
|
at «string»:1:10:
|
|
1| with {}; a
|
|
| ^
|
|
|
|
nix-repl> with {}; b
|
|
error: undefined variable 'b'
|
|
at «string»:1:10:
|
|
1| with {}; b
|
|
| ^
|
|
|
|
nix-repl> :bt
|
|
|
|
0: error: undefined variable 'b'
|
|
«string»:1:10
|
|
|
|
1| with {}; b
|
|
| ^
|
|
|
|
1: error: Fake frame for debugging purposes
|
|
«string»:1:10
|
|
|
|
1| with {}; b
|
|
| ^
|
|
|
|
exiting from here prints the error
|
|
nix-repl> :q
|
|
error: undefined variable 'b'
|
|
at «string»:1:10:
|
|
1| with {}; b
|
|
| ^
|