diff --git a/tests/functional/lang.sh b/tests/functional/lang.sh index 8310ac1f6..cac0b896d 100755 --- a/tests/functional/lang.sh +++ b/tests/functional/lang.sh @@ -25,7 +25,6 @@ nix-instantiate --eval -E 'builtins.addErrorContext "Hello" 123' 2>&1 nix-instantiate --trace-verbose --eval -E 'builtins.traceVerbose "Hello" 123' 2>&1 | grepQuiet Hello nix-instantiate --eval -E 'builtins.traceVerbose "Hello" 123' 2>&1 | grepQuietInverse Hello nix-instantiate --show-trace --eval -E 'builtins.addErrorContext "Hello" 123' 2>&1 | grepQuietInverse Hello -expectStderr 1 nix-instantiate --show-trace --eval -E 'builtins.addErrorContext "Hello" (throw "Foo")' | grepQuiet Hello expectStderr 1 nix-instantiate --show-trace --eval -E 'builtins.addErrorContext "Hello %" (throw "Foo")' | grepQuiet 'Hello %' nix-instantiate --eval -E 'let x = builtins.trace { x = x; } true; in x' \ diff --git a/tests/functional/lang/eval-okay-nul.flags b/tests/functional/lang/eval-okay-nul.flags deleted file mode 100644 index 33da0f779..000000000 --- a/tests/functional/lang/eval-okay-nul.flags +++ /dev/null @@ -1 +0,0 @@ ---extra-deprecated-features nul-bytes diff --git a/tests/functional/lang/eval-okay-nul.out.exp b/tests/functional/lang/eval-okay-nul.out.exp deleted file mode 100644 index 257cc5642..000000000 --- a/tests/functional/lang/eval-okay-nul.out.exp +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/tests/functional/lang/parse-fail-crlf.nix b/tests/functional/lang/parse-fail-crlf.nix deleted file mode 120000 index bcf59ab82..000000000 --- a/tests/functional/lang/parse-fail-crlf.nix +++ /dev/null @@ -1 +0,0 @@ -parse-okay-crlf.nix \ No newline at end of file diff --git a/tests/functional/lang/parse-fail-nul.nix b/tests/functional/lang/parse-fail-nul.nix deleted file mode 120000 index 9b0527d33..000000000 --- a/tests/functional/lang/parse-fail-nul.nix +++ /dev/null @@ -1 +0,0 @@ -eval-okay-nul.nix \ No newline at end of file diff --git a/tests/functional/lang/parse-okay-crlf.flags b/tests/functional/lang/parse-okay-crlf.flags deleted file mode 100644 index a7c7a5cbe..000000000 --- a/tests/functional/lang/parse-okay-crlf.flags +++ /dev/null @@ -1 +0,0 @@ ---extra-deprecated-features cr-line-endings diff --git a/tests/functional/lang/eval-fail-bad-string-interpolation-1.err.exp b/tests/functional2/lang/bad_string_interpolation/eval-fail-1.err.exp similarity index 60% rename from tests/functional/lang/eval-fail-bad-string-interpolation-1.err.exp rename to tests/functional2/lang/bad_string_interpolation/eval-fail-1.err.exp index 7c144c7e2..a9728e8bb 100644 --- a/tests/functional/lang/eval-fail-bad-string-interpolation-1.err.exp +++ b/tests/functional2/lang/bad_string_interpolation/eval-fail-1.err.exp @@ -1,8 +1,8 @@ error: … while evaluating a path segment - at /pwd/eval-fail-bad-string-interpolation-1.nix:1:2: + at /pwd/in.nix:1:2: 1| "${x: x}" | ^ 2| - error: cannot coerce a function to a string: «lambda @ /pwd/eval-fail-bad-string-interpolation-1.nix:1:4» + error: cannot coerce a function to a string: «lambda @ /pwd/in.nix:1:4» diff --git a/tests/functional/lang/eval-fail-bad-string-interpolation-2.err.exp b/tests/functional2/lang/bad_string_interpolation/eval-fail-2.err.exp similarity index 100% rename from tests/functional/lang/eval-fail-bad-string-interpolation-2.err.exp rename to tests/functional2/lang/bad_string_interpolation/eval-fail-2.err.exp diff --git a/tests/functional/lang/eval-fail-bad-string-interpolation-3.err.exp b/tests/functional2/lang/bad_string_interpolation/eval-fail-3.err.exp similarity index 60% rename from tests/functional/lang/eval-fail-bad-string-interpolation-3.err.exp rename to tests/functional2/lang/bad_string_interpolation/eval-fail-3.err.exp index ef79ad2ad..3a1e06e2e 100644 --- a/tests/functional/lang/eval-fail-bad-string-interpolation-3.err.exp +++ b/tests/functional2/lang/bad_string_interpolation/eval-fail-3.err.exp @@ -1,8 +1,8 @@ error: … while evaluating a path segment - at /pwd/eval-fail-bad-string-interpolation-3.nix:1:3: + at /pwd/in.nix:1:3: 1| ''${x: x}'' | ^ 2| - error: cannot coerce a function to a string: «lambda @ /pwd/eval-fail-bad-string-interpolation-3.nix:1:5» + error: cannot coerce a function to a string: «lambda @ /pwd/in.nix:1:5» diff --git a/tests/functional/lang/eval-fail-bad-string-interpolation-4.err.exp b/tests/functional2/lang/bad_string_interpolation/eval-fail-4.err.exp similarity index 86% rename from tests/functional/lang/eval-fail-bad-string-interpolation-4.err.exp rename to tests/functional2/lang/bad_string_interpolation/eval-fail-4.err.exp index bd4dc48ee..555bc7e70 100644 --- a/tests/functional/lang/eval-fail-bad-string-interpolation-4.err.exp +++ b/tests/functional2/lang/bad_string_interpolation/eval-fail-4.err.exp @@ -1,6 +1,6 @@ error: … while evaluating a path segment - at /pwd/eval-fail-bad-string-interpolation-4.nix:9:3: + at /pwd/in.nix:9:3: 8| # The error message should not be too long. 9| ''${pkgs}'' | ^ diff --git a/tests/functional/lang/eval-fail-bad-string-interpolation-1.nix b/tests/functional2/lang/bad_string_interpolation/in-1.nix similarity index 100% rename from tests/functional/lang/eval-fail-bad-string-interpolation-1.nix rename to tests/functional2/lang/bad_string_interpolation/in-1.nix diff --git a/tests/functional/lang/eval-fail-bad-string-interpolation-2.nix b/tests/functional2/lang/bad_string_interpolation/in-2.nix similarity index 100% rename from tests/functional/lang/eval-fail-bad-string-interpolation-2.nix rename to tests/functional2/lang/bad_string_interpolation/in-2.nix diff --git a/tests/functional/lang/eval-fail-bad-string-interpolation-3.nix b/tests/functional2/lang/bad_string_interpolation/in-3.nix similarity index 100% rename from tests/functional/lang/eval-fail-bad-string-interpolation-3.nix rename to tests/functional2/lang/bad_string_interpolation/in-3.nix diff --git a/tests/functional/lang/eval-fail-bad-string-interpolation-4.nix b/tests/functional2/lang/bad_string_interpolation/in-4.nix similarity index 100% rename from tests/functional/lang/eval-fail-bad-string-interpolation-4.nix rename to tests/functional2/lang/bad_string_interpolation/in-4.nix diff --git a/tests/functional2/lang/err_context/__init__.py b/tests/functional2/lang/err_context/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/functional2/lang/err_context/test_err_context.py b/tests/functional2/lang/err_context/test_err_context.py new file mode 100644 index 000000000..380b8b09d --- /dev/null +++ b/tests/functional2/lang/err_context/test_err_context.py @@ -0,0 +1,10 @@ +from functional2.testlib.fixtures.nix import Nix + + +def test_err_context(nix: Nix): + # the lang test framework doesn't check this folder, as there is a custom test in here + # it won't scream about missing an `in.nix` or .exp files + result = nix.nix_instantiate( + ["--show-trace", "--eval", "-E", 'builtins.addErrorContext "Hello" (throw "Foo")'] + ).run() + assert "Hello" in result.expect(1).stderr_s diff --git a/tests/functional/lang/eval-okay-import.exp b/tests/functional2/lang/import/eval-okay.out.exp similarity index 100% rename from tests/functional/lang/eval-okay-import.exp rename to tests/functional2/lang/import/eval-okay.out.exp diff --git a/tests/functional/lang/imported.nix b/tests/functional2/lang/import/imported.nix similarity index 100% rename from tests/functional/lang/imported.nix rename to tests/functional2/lang/import/imported.nix diff --git a/tests/functional/lang/imported2.nix b/tests/functional2/lang/import/imported2.nix similarity index 100% rename from tests/functional/lang/imported2.nix rename to tests/functional2/lang/import/imported2.nix diff --git a/tests/functional/lang/eval-okay-import.nix b/tests/functional2/lang/import/in.nix similarity index 100% rename from tests/functional/lang/eval-okay-import.nix rename to tests/functional2/lang/import/in.nix diff --git a/tests/functional2/lang/import/test.toml b/tests/functional2/lang/import/test.toml new file mode 100644 index 000000000..4c9e923e2 --- /dev/null +++ b/tests/functional2/lang/import/test.toml @@ -0,0 +1,3 @@ +[eval-okay] +runner = "eval-okay" +extra-files = ["imported.nix", "imported2.nix"] diff --git a/tests/functional/lang/parse-okay-crlf.exp b/tests/functional2/lang/line_endings/allow-depr.out.exp similarity index 100% rename from tests/functional/lang/parse-okay-crlf.exp rename to tests/functional2/lang/line_endings/allow-depr.out.exp diff --git a/tests/functional/lang/parse-fail-crlf.err.exp b/tests/functional2/lang/line_endings/depr.err.exp similarity index 88% rename from tests/functional/lang/parse-fail-crlf.err.exp rename to tests/functional2/lang/line_endings/depr.err.exp index 06c375774..f6ca6b19a 100644 --- a/tests/functional/lang/parse-fail-crlf.err.exp +++ b/tests/functional2/lang/line_endings/depr.err.exp @@ -1,11 +1,11 @@ warning: CR (`\r`) and CRLF (`\r\n`) line endings are not supported. Please inspect the file and normalize it to use LF (`\n`) line endings instead. Use --extra-deprecated-features cr-line-endings to silence this warning. - at /pwd/parse-okay-crlf.nix:7:21: + at /pwd/in.nix:7:21: 6| x = 7| # Dit is een test. | ^ 8| y; error: CR (`\r`) and CRLF (`\r\n`) line endings are not supported. Please inspect the file and normalize it to use LF (`\n`) line endings instead. Use --extra-deprecated-features cr-line-endings to silence this warning. - at /pwd/parse-okay-crlf.nix:14:15: + at /pwd/in.nix:14:15: 13| # translated to LF. 14| foo = "multi | ^ diff --git a/tests/functional/lang/parse-okay-crlf.nix b/tests/functional2/lang/line_endings/in.nix similarity index 100% rename from tests/functional/lang/parse-okay-crlf.nix rename to tests/functional2/lang/line_endings/in.nix diff --git a/tests/functional2/lang/line_endings/test.toml b/tests/functional2/lang/line_endings/test.toml new file mode 100644 index 000000000..beff445a7 --- /dev/null +++ b/tests/functional2/lang/line_endings/test.toml @@ -0,0 +1,6 @@ +[depr] +runner = "parse-fail" + +[allow-depr] +runner = "parse-okay" +flags = ["--extra-deprecated-features", "cr-line-endings"] diff --git a/tests/functional/lang/eval-okay-nul.exp b/tests/functional2/lang/nul_bytes/eval-allow-depr.out.exp similarity index 100% rename from tests/functional/lang/eval-okay-nul.exp rename to tests/functional2/lang/nul_bytes/eval-allow-depr.out.exp diff --git a/tests/functional/lang/parse-fail-nul.err.exp b/tests/functional2/lang/nul_bytes/eval-depr.err.exp similarity index 87% rename from tests/functional/lang/parse-fail-nul.err.exp rename to tests/functional2/lang/nul_bytes/eval-depr.err.exp index b0f3eb3b8..3512163d0 100644 Binary files a/tests/functional/lang/parse-fail-nul.err.exp and b/tests/functional2/lang/nul_bytes/eval-depr.err.exp differ diff --git a/tests/functional/lang/eval-okay-nul.nix b/tests/functional2/lang/nul_bytes/in.nix similarity index 100% rename from tests/functional/lang/eval-okay-nul.nix rename to tests/functional2/lang/nul_bytes/in.nix diff --git a/tests/functional2/lang/nul_bytes/parse-allow-depr.out.exp b/tests/functional2/lang/nul_bytes/parse-allow-depr.out.exp new file mode 100644 index 000000000..9b92fcc9a --- /dev/null +++ b/tests/functional2/lang/nul_bytes/parse-allow-depr.out.exp @@ -0,0 +1,3 @@ +_type: ExprLiteral +value: foo +valueType: String diff --git a/tests/functional2/lang/nul_bytes/parse-depr.err.exp b/tests/functional2/lang/nul_bytes/parse-depr.err.exp new file mode 100644 index 000000000..3512163d0 Binary files /dev/null and b/tests/functional2/lang/nul_bytes/parse-depr.err.exp differ diff --git a/tests/functional2/lang/nul_bytes/test.toml b/tests/functional2/lang/nul_bytes/test.toml new file mode 100644 index 000000000..772fbd8f2 --- /dev/null +++ b/tests/functional2/lang/nul_bytes/test.toml @@ -0,0 +1,13 @@ +[eval-depr] +runner = "eval-fail" + +[eval-allow-depr] +runner = "eval-okay" +flags = ["--extra-deprecated-features", "nul-bytes"] + +[parse-depr] +runner = "parse-fail" + +[parse-allow-depr] +runner = "parse-okay" +flags = ["--extra-deprecated-features", "nul-bytes"] diff --git a/tests/functional/lang/eval-fail-scope-5.err.exp b/tests/functional2/lang/scope/eval-fail-5.err.exp similarity index 75% rename from tests/functional/lang/eval-fail-scope-5.err.exp rename to tests/functional2/lang/scope/eval-fail-5.err.exp index 0eb2a692e..af0632055 100644 --- a/tests/functional/lang/eval-fail-scope-5.err.exp +++ b/tests/functional2/lang/scope/eval-fail-5.err.exp @@ -1,34 +1,34 @@ error: … from call site - at /pwd/eval-fail-scope-5.nix:7:3: + at /pwd/in.nix:7:3: 6| in 7| f {} | ^ 8| … while calling 'f' - at /pwd/eval-fail-scope-5.nix:5:7: + at /pwd/in.nix:5:7: 4| 5| f = {x ? y, y ? x}: x + y; | ^ 6| in … while evaluating x - at /pwd/eval-fail-scope-5.nix:5:23: + at /pwd/in.nix:5:23: 4| 5| f = {x ? y, y ? x}: x + y; | ^ 6| in … while evaluating y - at /pwd/eval-fail-scope-5.nix:5:12: + at /pwd/in.nix:5:12: 4| 5| f = {x ? y, y ? x}: x + y; | ^ 6| in error: infinite recursion encountered - at /pwd/eval-fail-scope-5.nix:5:12: + at /pwd/in.nix:5:12: 4| 5| f = {x ? y, y ? x}: x + y; | ^ diff --git a/tests/functional/lang/eval-okay-scope-1.exp b/tests/functional2/lang/scope/eval-okay-1.out.exp similarity index 100% rename from tests/functional/lang/eval-okay-scope-1.exp rename to tests/functional2/lang/scope/eval-okay-1.out.exp diff --git a/tests/functional/lang/eval-okay-scope-2.exp b/tests/functional2/lang/scope/eval-okay-2.out.exp similarity index 100% rename from tests/functional/lang/eval-okay-scope-2.exp rename to tests/functional2/lang/scope/eval-okay-2.out.exp diff --git a/tests/functional/lang/eval-okay-scope-3.exp b/tests/functional2/lang/scope/eval-okay-3.out.exp similarity index 100% rename from tests/functional/lang/eval-okay-scope-3.exp rename to tests/functional2/lang/scope/eval-okay-3.out.exp diff --git a/tests/functional/lang/eval-okay-scope-4.exp b/tests/functional2/lang/scope/eval-okay-4.out.exp similarity index 100% rename from tests/functional/lang/eval-okay-scope-4.exp rename to tests/functional2/lang/scope/eval-okay-4.out.exp diff --git a/tests/functional/lang/eval-okay-scope-6.exp b/tests/functional2/lang/scope/eval-okay-6.out.exp similarity index 100% rename from tests/functional/lang/eval-okay-scope-6.exp rename to tests/functional2/lang/scope/eval-okay-6.out.exp diff --git a/tests/functional/lang/eval-okay-scope-7.exp b/tests/functional2/lang/scope/eval-okay-7.out.exp similarity index 100% rename from tests/functional/lang/eval-okay-scope-7.exp rename to tests/functional2/lang/scope/eval-okay-7.out.exp diff --git a/tests/functional/lang/eval-okay-scope-1.nix b/tests/functional2/lang/scope/in-1.nix similarity index 100% rename from tests/functional/lang/eval-okay-scope-1.nix rename to tests/functional2/lang/scope/in-1.nix diff --git a/tests/functional/lang/eval-okay-scope-2.nix b/tests/functional2/lang/scope/in-2.nix similarity index 100% rename from tests/functional/lang/eval-okay-scope-2.nix rename to tests/functional2/lang/scope/in-2.nix diff --git a/tests/functional/lang/eval-okay-scope-3.nix b/tests/functional2/lang/scope/in-3.nix similarity index 100% rename from tests/functional/lang/eval-okay-scope-3.nix rename to tests/functional2/lang/scope/in-3.nix diff --git a/tests/functional/lang/eval-okay-scope-4.nix b/tests/functional2/lang/scope/in-4.nix similarity index 100% rename from tests/functional/lang/eval-okay-scope-4.nix rename to tests/functional2/lang/scope/in-4.nix diff --git a/tests/functional/lang/eval-fail-scope-5.nix b/tests/functional2/lang/scope/in-5.nix similarity index 100% rename from tests/functional/lang/eval-fail-scope-5.nix rename to tests/functional2/lang/scope/in-5.nix diff --git a/tests/functional/lang/eval-okay-scope-6.nix b/tests/functional2/lang/scope/in-6.nix similarity index 100% rename from tests/functional/lang/eval-okay-scope-6.nix rename to tests/functional2/lang/scope/in-6.nix diff --git a/tests/functional/lang/eval-okay-scope-7.nix b/tests/functional2/lang/scope/in-7.nix similarity index 100% rename from tests/functional/lang/eval-okay-scope-7.nix rename to tests/functional2/lang/scope/in-7.nix diff --git a/tests/functional/lang/eval-okay-with.exp b/tests/functional2/lang/with/eval-okay.out.exp similarity index 100% rename from tests/functional/lang/eval-okay-with.exp rename to tests/functional2/lang/with/eval-okay.out.exp diff --git a/tests/functional/lang/eval-okay-with.nix b/tests/functional2/lang/with/in.nix similarity index 100% rename from tests/functional/lang/eval-okay-with.nix rename to tests/functional2/lang/with/in.nix