aboutsummaryrefslogtreecommitdiff
path: root/tests/functional/misc.sh
diff options
context:
space:
mode:
authorCole Helbling <cole.e.helbling@outlook.com>2024-05-14 12:13:40 -0700
committerMaximilian Bosch <maximilian@mbosch.me>2024-05-30 03:07:21 +0000
commit031d92411637904a8ed759dc80bc474213dd4fa9 (patch)
treeb01c2401c71daeb868dbc8996dc34eb3482a4178 /tests/functional/misc.sh
parent218630a241d71ea5c136f72e1aaaf2299df6a0b1 (diff)
libutil/args: warn on unknown settings after parsing all flags
Upstream change: https://github.com/NixOS/nix/pull/10701 Change-Id: Icf271df57ec529dd8c64667d1ef9f6dbf02d33d3
Diffstat (limited to 'tests/functional/misc.sh')
-rw-r--r--tests/functional/misc.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/functional/misc.sh b/tests/functional/misc.sh
index af96d20bd..d4379b7ce 100644
--- a/tests/functional/misc.sh
+++ b/tests/functional/misc.sh
@@ -30,3 +30,12 @@ expectStderr 1 nix-instantiate --eval -E '[]' -A 'x' | grepQuiet "should be a se
expectStderr 1 nix-instantiate --eval -E '{}' -A '1' | grepQuiet "should be a list"
expectStderr 1 nix-instantiate --eval -E '{}' -A '.' | grepQuiet "empty attribute name"
expectStderr 1 nix-instantiate --eval -E '[]' -A '1' | grepQuiet "out of range"
+
+# Unknown setting warning
+# NOTE(cole-h): behavior is different depending on the order, which is why we test an unknown option
+# before and after the `'{}'`!
+out="$(expectStderr 0 nix-instantiate --option foobar baz --expr '{}')"
+[[ "$(echo "$out" | grep foobar | wc -l)" = 1 ]]
+
+out="$(expectStderr 0 nix-instantiate '{}' --option foobar baz --expr )"
+[[ "$(echo "$out" | grep foobar | wc -l)" = 1 ]]