mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-21 21:46:15 +02:00
Add a test that nix repl --show-trace actually shows the trace
This commit is contained in:
parent
581f774284
commit
2dc29e0d93
2 changed files with 10 additions and 1 deletions
|
@ -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
|
||||
|
|
1
tests/undefined-variable.nix
Normal file
1
tests/undefined-variable.nix
Normal file
|
@ -0,0 +1 @@
|
|||
let f = builtins.toFile "test-file.nix" "asd"; in import f
|
Loading…
Reference in a new issue