mirror of
https://github.com/NixOS/nix
synced 2025-06-25 02:21:16 +02:00
tests/functional/lang: Add post processing and remove certain line numbers
This commit is contained in:
parent
74698d54c8
commit
f9a1d6b018
3 changed files with 37 additions and 13 deletions
|
@ -50,11 +50,22 @@ set +x
|
|||
badDiff=0
|
||||
badExitCode=0
|
||||
|
||||
# Extra post-processing that's specific to each test case
|
||||
postprocess() {
|
||||
if [[ -e "lang/$1.postprocess" ]]; then
|
||||
(
|
||||
set -x;
|
||||
"lang/$1.postprocess" "lang/$1"
|
||||
)
|
||||
fi
|
||||
}
|
||||
|
||||
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"
|
||||
then
|
||||
postprocess "$i"
|
||||
diffAndAccept "$i" err err.exp
|
||||
else
|
||||
echo "FAIL: $i shouldn't parse"
|
||||
|
@ -71,6 +82,7 @@ for i in lang/parse-okay-*.nix; do
|
|||
2> "lang/$i.err"
|
||||
then
|
||||
sed "s!$(pwd)!/pwd!g" "lang/$i.out" "lang/$i.err"
|
||||
postprocess "$i"
|
||||
diffAndAccept "$i" out exp
|
||||
diffAndAccept "$i" err err.exp
|
||||
else
|
||||
|
@ -94,6 +106,7 @@ for i in lang/eval-fail-*.nix; do
|
|||
expectStderr 1 nix-instantiate $flags "lang/$i.nix" \
|
||||
| sed "s!$(pwd)!/pwd!g" > "lang/$i.err"
|
||||
then
|
||||
postprocess "$i"
|
||||
diffAndAccept "$i" err err.exp
|
||||
else
|
||||
echo "FAIL: $i shouldn't evaluate"
|
||||
|
@ -109,6 +122,7 @@ for i in lang/eval-okay-*.nix; do
|
|||
if expect 0 nix-instantiate --eval --xml --no-location --strict \
|
||||
"lang/$i.nix" > "lang/$i.out.xml"
|
||||
then
|
||||
postprocess "$i"
|
||||
diffAndAccept "$i" out.xml exp.xml
|
||||
else
|
||||
echo "FAIL: $i should evaluate"
|
||||
|
@ -129,6 +143,7 @@ for i in lang/eval-okay-*.nix; do
|
|||
2> "lang/$i.err"
|
||||
then
|
||||
sed -i "s!$(pwd)!/pwd!g" "lang/$i.out" "lang/$i.err"
|
||||
postprocess "$i"
|
||||
diffAndAccept "$i" out exp
|
||||
diffAndAccept "$i" err err.exp
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue