tests/functional2/lang: migrated first tests
Change-Id: I4b5755a63d9454db20f63f751f5f33564a2ee5be
This commit is contained in:
@@ -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' \
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
--extra-deprecated-features nul-bytes
|
||||
@@ -1 +0,0 @@
|
||||
foo
|
||||
@@ -1 +0,0 @@
|
||||
parse-okay-crlf.nix
|
||||
@@ -1 +0,0 @@
|
||||
eval-okay-nul.nix
|
||||
@@ -1 +0,0 @@
|
||||
--extra-deprecated-features cr-line-endings
|
||||
+2
-2
@@ -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»
|
||||
+2
-2
@@ -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»
|
||||
+1
-1
@@ -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}''
|
||||
| ^
|
||||
@@ -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
|
||||
@@ -0,0 +1,3 @@
|
||||
[eval-okay]
|
||||
runner = "eval-okay"
|
||||
extra-files = ["imported.nix", "imported2.nix"]
|
||||
+2
-2
@@ -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
|
||||
| ^
|
||||
@@ -0,0 +1,6 @@
|
||||
[depr]
|
||||
runner = "parse-fail"
|
||||
|
||||
[allow-depr]
|
||||
runner = "parse-okay"
|
||||
flags = ["--extra-deprecated-features", "cr-line-endings"]
|
||||
BIN
Binary file not shown.
@@ -0,0 +1,3 @@
|
||||
_type: ExprLiteral
|
||||
value: foo
|
||||
valueType: String
|
||||
Binary file not shown.
@@ -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"]
|
||||
+5
-5
@@ -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;
|
||||
| ^
|
||||
Reference in New Issue
Block a user