diff options
Diffstat (limited to 'tests/repl.sh')
-rw-r--r-- | tests/repl.sh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/repl.sh b/tests/repl.sh index d360821f2..0e23a98db 100644 --- a/tests/repl.sh +++ b/tests/repl.sh @@ -1,8 +1,20 @@ source common.sh replCmds=" +simple = 1 simple = import ./simple.nix :b simple +:log simple +" + +replFailingCmds=" +failing = import ./simple-failing.nix +:b failing +:log failing +" + +replUndefinedVariable=" +import ./undefined-variable.nix " testRepl () { @@ -12,6 +24,16 @@ testRepl () { local outPath=$(echo "$replOutput" |& grep -o -E "$NIX_STORE_DIR/\w*-simple") 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" 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 |