diff options
author | Alexander Bantyev <balsoft@balsoft.ru> | 2021-12-28 15:54:46 +0300 |
---|---|---|
committer | Alexander Bantyev <balsoft@balsoft.ru> | 2021-12-28 15:54:46 +0300 |
commit | 2dc29e0d932822baa50dbc3e81ae108382c39062 (patch) | |
tree | 35322c7e22334956b61817ca1e8f25f6a4e7f74f /tests | |
parent | 581f774284fa1b833255218165f4c958fe741500 (diff) |
Add a test that nix repl --show-trace actually shows the trace
Diffstat (limited to 'tests')
-rw-r--r-- | tests/repl.sh | 10 | ||||
-rw-r--r-- | tests/undefined-variable.nix | 1 |
2 files changed, 10 insertions, 1 deletions
diff --git a/tests/repl.sh b/tests/repl.sh index 995db869c..0e23a98db 100644 --- a/tests/repl.sh +++ b/tests/repl.sh @@ -13,6 +13,10 @@ failing = import ./simple-failing.nix :log failing " +replUndefinedVariable=" +import ./undefined-variable.nix +" + testRepl () { local nixArgs=("$@") local replOutput="$(nix repl "${nixArgs[@]}" <<< "$replCmds")" @@ -22,10 +26,14 @@ testRepl () { nix path-info "${nixArgs[@]}" "$outPath" # simple.nix prints a PATH during build echo "$replOutput" | grep -qs 'PATH=' || fail "nix repl :log doesn't output logs" - local replOutput="$(nix repl "${nixArgs[@]}" <<< "$replFailingCmds")" + local replOutput="$(nix repl "${nixArgs[@]}" <<< "$replFailingCmds" 2>&1)" echo "$replOutput" echo "$replOutput" | grep -qs 'This should fail' \ || fail "nix repl :log doesn't output logs for a failed derivation" + local replOutput="$(nix repl --show-trace "${nixArgs[@]}" <<< "$replUndefinedVariable" 2>&1)" + echo "$replOutput" + echo "$replOutput" | grep -qs "while evaluating the file" \ + || fail "nix repl --show-trace doesn't show the trace" } # Simple test, try building a drv diff --git a/tests/undefined-variable.nix b/tests/undefined-variable.nix new file mode 100644 index 000000000..579985497 --- /dev/null +++ b/tests/undefined-variable.nix @@ -0,0 +1 @@ +let f = builtins.toFile "test-file.nix" "asd"; in import f |