aboutsummaryrefslogtreecommitdiff
path: root/tests/functional
diff options
context:
space:
mode:
authorpiegames <git@piegames.de>2024-08-25 10:22:30 +0200
committerpiegames <git@piegames.de>2024-10-18 11:40:04 +0000
commit580df9bdb39fdf80625bed810b3fc1625be7ee93 (patch)
tree53f6ac445d53055979d49ffadf1f5813efad506f /tests/functional
parent52b64662a4924741e465b9caed6b2b4f8539aced (diff)
tests/functional-lang: Small cleanup of flagfiles handling
Flag files now properly work for all tests. Change-Id: If652235960e8cf4120270a1b974c17586a31a157
Diffstat (limited to 'tests/functional')
-rwxr-xr-xtests/functional/lang.sh39
1 files changed, 18 insertions, 21 deletions
diff --git a/tests/functional/lang.sh b/tests/functional/lang.sh
index ca54fb88d..cec4f9352 100755
--- a/tests/functional/lang.sh
+++ b/tests/functional/lang.sh
@@ -41,7 +41,12 @@ badExitCode=0
for i in lang/parse-fail-*.nix; do
echo "parsing $i (should fail)";
i=$(basename "$i" .nix)
- if expectStderr 1 nix-instantiate --parse - < "lang/$i.nix" > "lang/$i.err"
+
+ declare -a flags=()
+ if test -e "lang/$i.flags"; then
+ read -r -a flags < "lang/$i.flags"
+ fi
+ if expectStderr 1 nix-instantiate --parse "${flags[@]}" - < "lang/$i.nix" > "lang/$i.err"
then
diffAndAccept "$i" err err.exp
else
@@ -54,13 +59,12 @@ for i in lang/parse-okay-*.nix; do
echo "parsing $i (should succeed)";
i=$(basename "$i" .nix)
- if [ -e "lang/$i.flags" ]; then
- extraArgs="$(cat "lang/$i.flags")"
- else
- extraArgs=""
+ declare -a flags=()
+ if test -e "lang/$i.flags"; then
+ read -r -a flags < "lang/$i.flags"
fi
if
- expect 0 nix-instantiate --parse ${extraArgs-} - < "lang/$i.nix" \
+ expect 0 nix-instantiate --parse "${flags[@]}" - < "lang/$i.nix" \
1> "lang/$i.out" \
2> "lang/$i.err"
then
@@ -77,13 +81,12 @@ for i in lang/eval-fail-*.nix; do
echo "evaluating $i (should fail)";
i=$(basename "$i" .nix)
- if [ -e "lang/$i.flags" ]; then
- extraArgs="$(cat "lang/$i.flags")"
- else
- extraArgs=""
+ declare -a flags=()
+ if test -e "lang/$i.flags"; then
+ read -r -a flags < "lang/$i.flags"
fi
if
- expectStderr 1 nix-instantiate --eval --strict --show-trace ${extraArgs-} "lang/$i.nix" \
+ expectStderr 1 nix-instantiate --eval --strict --show-trace "${flags[@]}" "lang/$i.nix" \
| sed "s!$(pwd)!/pwd!g" > "lang/$i.err"
then
diffAndAccept "$i" err err.exp
@@ -97,14 +100,13 @@ for i in lang/eval-okay-*.nix; do
echo "evaluating $i (should succeed)";
i=$(basename "$i" .nix)
- if [ -e "lang/$i.flags" ]; then
- extraArgs="$(cat "lang/$i.flags")"
- else
- extraArgs=""
+ declare -a flags=()
+ if test -e "lang/$i.flags"; then
+ read -r -a flags < "lang/$i.flags"
fi
if test -e "lang/$i.exp.xml"; then
- if expect 0 nix-instantiate --eval --xml --no-location --strict ${extraArgs-} \
+ if expect 0 nix-instantiate --eval --xml --no-location --strict "${flags[@]}" \
"lang/$i.nix" > "lang/$i.out.xml"
then
diffAndAccept "$i" out.xml exp.xml
@@ -113,11 +115,6 @@ for i in lang/eval-okay-*.nix; do
badExitCode=1
fi
elif test ! -e "lang/$i.exp-disabled"; then
- declare -a flags=()
- if test -e "lang/$i.flags"; then
- read -r -a flags < "lang/$i.flags"
- fi
-
if
expect 0 env \
NIX_PATH=lang/dir3:lang/dir4 \