From 721db28037817a973255f3a234aac1dc51b8ade3 Mon Sep 17 00:00:00 2001 From: piegames Date: Tue, 26 Aug 2025 09:12:45 +0200 Subject: [PATCH] tests/functional2/lang: Migrate eof tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Call it a bug, call it a feature, but the old testing framework ungracefully shits itself when it has no tests to run … in other words, we finally migrated all the parse-fail tests 🎉 Change-Id: Ibd7f1c04d9a396a20f14361af7924f0074d1ac23 --- tests/functional/lang.sh | 18 ------------------ .../lang/parser-eof/in-string.nix} | 0 .../lang/parser-eof/in.nix} | 0 .../lang/parser-eof/parse-fail-string.err.exp} | 2 +- .../lang/parser-eof/parse-fail.err.exp} | 2 +- 5 files changed, 2 insertions(+), 20 deletions(-) rename tests/{functional/lang/parse-fail-eof-in-string.nix => functional2/lang/parser-eof/in-string.nix} (100%) rename tests/{functional/lang/parse-fail-eof-pos.nix => functional2/lang/parser-eof/in.nix} (100%) rename tests/{functional/lang/parse-fail-eof-in-string.err.exp => functional2/lang/parser-eof/parse-fail-string.err.exp} (77%) rename tests/{functional/lang/parse-fail-eof-pos.err.exp => functional2/lang/parser-eof/parse-fail.err.exp} (74%) diff --git a/tests/functional/lang.sh b/tests/functional/lang.sh index fa8a3406e..5dd88df3c 100755 --- a/tests/functional/lang.sh +++ b/tests/functional/lang.sh @@ -38,24 +38,6 @@ set +x badDiff=0 badExitCode=0 -for i in parse-fail-*.nix; do - echo "parsing $i (should fail)"; - i=$(basename "$i" .nix) - - declare -a flags=() - if test -e "$i.flags"; then - read -r -a flags < "$i.flags" - fi - if expectStderr 1 nix-instantiate --parse "${flags[@]}" "$i.nix" > "$i.err" - then - sed -i "s!$(pwd)!/pwd!g" "$i.err" - diffAndAccept "$i" err err.exp - else - echo "FAIL: $i shouldn't parse" - badExitCode=1 - fi -done - for i in eval-fail-*.nix; do echo "evaluating $i (should fail)"; i=$(basename "$i" .nix) diff --git a/tests/functional/lang/parse-fail-eof-in-string.nix b/tests/functional2/lang/parser-eof/in-string.nix similarity index 100% rename from tests/functional/lang/parse-fail-eof-in-string.nix rename to tests/functional2/lang/parser-eof/in-string.nix diff --git a/tests/functional/lang/parse-fail-eof-pos.nix b/tests/functional2/lang/parser-eof/in.nix similarity index 100% rename from tests/functional/lang/parse-fail-eof-pos.nix rename to tests/functional2/lang/parser-eof/in.nix diff --git a/tests/functional/lang/parse-fail-eof-in-string.err.exp b/tests/functional2/lang/parser-eof/parse-fail-string.err.exp similarity index 77% rename from tests/functional/lang/parse-fail-eof-in-string.err.exp rename to tests/functional2/lang/parser-eof/parse-fail-string.err.exp index 24d5dec13..81ab7f53e 100644 --- a/tests/functional/lang/parse-fail-eof-in-string.err.exp +++ b/tests/functional2/lang/parser-eof/parse-fail-string.err.exp @@ -1,5 +1,5 @@ error: syntax error, unexpected end of file, expecting '"' - at /pwd/parse-fail-eof-in-string.nix:3:6: + at /pwd/in.nix:3:6: 2| # Note that this file must not end with a newline. 3| a 1"$ | ^ diff --git a/tests/functional/lang/parse-fail-eof-pos.err.exp b/tests/functional2/lang/parser-eof/parse-fail.err.exp similarity index 74% rename from tests/functional/lang/parse-fail-eof-pos.err.exp rename to tests/functional2/lang/parser-eof/parse-fail.err.exp index d21e5e7c0..6f621eb8a 100644 --- a/tests/functional/lang/parse-fail-eof-pos.err.exp +++ b/tests/functional2/lang/parser-eof/parse-fail.err.exp @@ -1,5 +1,5 @@ error: syntax error, unexpected end of file, expecting expression - at /pwd/parse-fail-eof-pos.nix:3:1: + at /pwd/in.nix:3:1: 2| # no content 3| | ^