aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorYorick van Pelt <yorick@yorickvanpelt.nl>2022-11-03 10:11:28 +0100
committerYorick van Pelt <yorick@yorickvanpelt.nl>2022-11-03 10:11:28 +0100
commit16f1720fd2ac1c74043492e71a3e0a3327db4919 (patch)
tree10f8ee14475fbfacbc0d70e878685ae6a50ca2e6 /tests
parent444af855523b00b0959273bab9d7343312817cb3 (diff)
SourceExprCommand: swallow EvalError, add tests for this
Completing things that would error would print an ugly error in the middle of your command line. Avoid printing this error.
Diffstat (limited to 'tests')
-rw-r--r--tests/completions.sh6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/completions.sh b/tests/completions.sh
index 522aa1c86..19dc61098 100644
--- a/tests/completions.sh
+++ b/tests/completions.sh
@@ -28,6 +28,10 @@ cat <<EOF > bar/flake.nix
};
}
EOF
+mkdir -p err
+cat <<EOF > err/flake.nix
+throw "error"
+EOF
# Test the completion of a subcommand
[[ "$(NIX_GET_COMPLETIONS=1 nix buil)" == $'normal\nbuild\t' ]]
@@ -60,3 +64,5 @@ NIX_GET_COMPLETIONS=3 nix build --option allow-import-from | grep -- "allow-impo
# Attr path completions
[[ "$(NIX_GET_COMPLETIONS=2 nix eval ./foo\#sam)" == $'attrs\n./foo#sampleOutput\t' ]]
[[ "$(NIX_GET_COMPLETIONS=4 nix eval --file ./foo/flake.nix outp)" == $'attrs\noutputs\t' ]]
+[[ "$(NIX_GET_COMPLETIONS=4 nix eval --file ./err/flake.nix outp 2>&1)" == $'attrs' ]]
+[[ "$(NIX_GET_COMPLETIONS=2 nix eval ./err\# 2>&1)" == $'attrs' ]]