aboutsummaryrefslogtreecommitdiff
path: root/tests/lang
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lang')
-rw-r--r--tests/lang/empty.exp0
-rw-r--r--tests/lang/eval-fail-abort.err.exp10
-rw-r--r--tests/lang/eval-fail-antiquoted-path.err.exp1
-rw-r--r--tests/lang/eval-fail-assert.err.exp36
-rw-r--r--tests/lang/eval-fail-bad-antiquote-1.err.exp10
-rw-r--r--tests/lang/eval-fail-bad-antiquote-2.err.exp1
-rw-r--r--tests/lang/eval-fail-bad-antiquote-3.err.exp10
-rw-r--r--tests/lang/eval-fail-bad-string-interpolation-1.err.exp10
-rw-r--r--tests/lang/eval-fail-bad-string-interpolation-1.nix (renamed from tests/lang/eval-fail-bad-antiquote-1.nix)0
-rw-r--r--tests/lang/eval-fail-bad-string-interpolation-2.err.exp1
-rw-r--r--tests/lang/eval-fail-bad-string-interpolation-2.nix (renamed from tests/lang/eval-fail-bad-antiquote-2.nix)0
-rw-r--r--tests/lang/eval-fail-bad-string-interpolation-3.err.exp10
-rw-r--r--tests/lang/eval-fail-bad-string-interpolation-3.nix (renamed from tests/lang/eval-fail-bad-antiquote-3.nix)0
-rw-r--r--tests/lang/eval-fail-blackhole.err.exp18
-rw-r--r--tests/lang/eval-fail-deepseq.err.exp26
-rw-r--r--tests/lang/eval-fail-dup-dynamic-attrs.err.exp8
-rw-r--r--tests/lang/eval-fail-dup-dynamic-attrs.nix4
-rw-r--r--tests/lang/eval-fail-foldlStrict-strict-op-application.err.exp38
-rw-r--r--tests/lang/eval-fail-fromTOML-timestamps.err.exp12
-rw-r--r--tests/lang/eval-fail-fromTOML-timestamps.nix130
-rw-r--r--tests/lang/eval-fail-hashfile-missing.err.exp19
-rw-r--r--tests/lang/eval-fail-list.err.exp10
-rw-r--r--tests/lang/eval-fail-list.nix1
-rw-r--r--tests/lang/eval-fail-missing-arg.err.exp16
-rw-r--r--tests/lang/eval-fail-nonexist-path.err.exp1
-rw-r--r--tests/lang/eval-fail-path-slash.err.exp8
-rw-r--r--tests/lang/eval-fail-recursion.err.exp16
-rw-r--r--tests/lang/eval-fail-recursion.nix1
-rw-r--r--tests/lang/eval-fail-remove.err.exp19
-rw-r--r--tests/lang/eval-fail-scope-5.err.exp36
-rw-r--r--tests/lang/eval-fail-seq.err.exp18
-rw-r--r--tests/lang/eval-fail-set-override.err.exp6
-rw-r--r--tests/lang/eval-fail-set-override.nix1
-rw-r--r--tests/lang/eval-fail-set.err.exp7
-rw-r--r--tests/lang/eval-fail-set.nix1
-rw-r--r--tests/lang/eval-fail-substring.err.exp12
-rw-r--r--tests/lang/eval-fail-to-path.err.exp14
-rw-r--r--tests/lang/eval-fail-toJSON.err.exp57
-rw-r--r--tests/lang/eval-fail-toJSON.nix10
-rw-r--r--tests/lang/eval-fail-undeclared-arg.err.exp17
-rw-r--r--tests/lang/eval-okay-flake-ref-to-string.exp1
-rw-r--r--tests/lang/eval-okay-flake-ref-to-string.nix7
-rw-r--r--tests/lang/eval-okay-fromTOML-timestamps.exp1
-rw-r--r--tests/lang/eval-okay-fromTOML-timestamps.flags1
-rw-r--r--tests/lang/eval-okay-fromTOML-timestamps.nix130
-rw-r--r--tests/lang/eval-okay-fromjson.nix14
-rw-r--r--tests/lang/eval-okay-merge-dynamic-attrs.exp1
-rw-r--r--tests/lang/eval-okay-merge-dynamic-attrs.nix13
-rw-r--r--tests/lang/eval-okay-overrides.nix2
-rw-r--r--tests/lang/eval-okay-parse-flake-ref.exp1
-rw-r--r--tests/lang/eval-okay-parse-flake-ref.nix1
-rw-r--r--tests/lang/eval-okay-path-string-interpolation.exp (renamed from tests/lang/eval-okay-path-antiquotation.exp)0
-rw-r--r--tests/lang/eval-okay-path-string-interpolation.nix (renamed from tests/lang/eval-okay-path-antiquotation.nix)0
-rw-r--r--tests/lang/eval-okay-pathexists.nix5
-rw-r--r--tests/lang/eval-okay-print.err.exp1
-rw-r--r--tests/lang/eval-okay-print.exp1
-rw-r--r--tests/lang/eval-okay-print.nix1
-rw-r--r--tests/lang/eval-okay-replacestrings.exp2
-rw-r--r--tests/lang/eval-okay-replacestrings.nix1
-rw-r--r--tests/lang/eval-okay-search-path.flags2
-rw-r--r--tests/lang/framework.sh33
-rw-r--r--tests/lang/parse-fail-dup-attrs-1.err.exp7
-rw-r--r--tests/lang/parse-fail-dup-attrs-2.err.exp7
-rw-r--r--tests/lang/parse-fail-dup-attrs-3.err.exp7
-rw-r--r--tests/lang/parse-fail-dup-attrs-4.err.exp7
-rw-r--r--tests/lang/parse-fail-dup-attrs-6.err.exp1
-rw-r--r--tests/lang/parse-fail-dup-attrs-7.err.exp7
-rw-r--r--tests/lang/parse-fail-dup-formals.err.exp6
-rw-r--r--tests/lang/parse-fail-eof-in-string.err.exp7
-rw-r--r--tests/lang/parse-fail-mixed-nested-attrs1.err.exp8
-rw-r--r--tests/lang/parse-fail-mixed-nested-attrs2.err.exp8
-rw-r--r--tests/lang/parse-fail-patterns-1.err.exp7
-rw-r--r--tests/lang/parse-fail-regression-20060610.err.exp8
-rw-r--r--tests/lang/parse-fail-undef-var-2.err.exp7
-rw-r--r--tests/lang/parse-fail-undef-var.err.exp7
-rw-r--r--tests/lang/parse-fail-utf8.err.exp6
-rw-r--r--tests/lang/parse-fail-utf8.nix (renamed from tests/lang/parse-fail-uft8.nix)0
-rw-r--r--tests/lang/parse-okay-1.exp1
-rw-r--r--tests/lang/parse-okay-crlf.exp1
-rw-r--r--tests/lang/parse-okay-dup-attrs-5.exp1
-rw-r--r--tests/lang/parse-okay-dup-attrs-6.exp1
-rw-r--r--tests/lang/parse-okay-mixed-nested-attrs-1.exp1
-rw-r--r--tests/lang/parse-okay-mixed-nested-attrs-2.exp1
-rw-r--r--tests/lang/parse-okay-mixed-nested-attrs-3.exp1
-rw-r--r--tests/lang/parse-okay-regression-20041027.exp1
-rw-r--r--tests/lang/parse-okay-regression-751.exp1
-rw-r--r--tests/lang/parse-okay-subversion.exp1
-rw-r--r--tests/lang/parse-okay-url.exp1
88 files changed, 916 insertions, 8 deletions
diff --git a/tests/lang/empty.exp b/tests/lang/empty.exp
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/lang/empty.exp
diff --git a/tests/lang/eval-fail-abort.err.exp b/tests/lang/eval-fail-abort.err.exp
new file mode 100644
index 000000000..345232d3f
--- /dev/null
+++ b/tests/lang/eval-fail-abort.err.exp
@@ -0,0 +1,10 @@
+error:
+ … while calling the 'abort' builtin
+
+ at /pwd/lang/eval-fail-abort.nix:1:14:
+
+ 1| if true then abort "this should fail" else 1
+ | ^
+ 2|
+
+ error: evaluation aborted with the following error message: 'this should fail'
diff --git a/tests/lang/eval-fail-antiquoted-path.err.exp b/tests/lang/eval-fail-antiquoted-path.err.exp
new file mode 100644
index 000000000..425deba42
--- /dev/null
+++ b/tests/lang/eval-fail-antiquoted-path.err.exp
@@ -0,0 +1 @@
+error: getting attributes of path ‘PWD/lang/fnord’: No such file or directory
diff --git a/tests/lang/eval-fail-assert.err.exp b/tests/lang/eval-fail-assert.err.exp
new file mode 100644
index 000000000..aeecd8167
--- /dev/null
+++ b/tests/lang/eval-fail-assert.err.exp
@@ -0,0 +1,36 @@
+error:
+ … while evaluating the attribute 'body'
+
+ at /pwd/lang/eval-fail-assert.nix:4:3:
+
+ 3|
+ 4| body = x "x";
+ | ^
+ 5| }
+
+ … from call site
+
+ at /pwd/lang/eval-fail-assert.nix:4:10:
+
+ 3|
+ 4| body = x "x";
+ | ^
+ 5| }
+
+ … while calling 'x'
+
+ at /pwd/lang/eval-fail-assert.nix:2:7:
+
+ 1| let {
+ 2| x = arg: assert arg == "y"; 123;
+ | ^
+ 3|
+
+ error: assertion '(arg == "y")' failed
+
+ at /pwd/lang/eval-fail-assert.nix:2:12:
+
+ 1| let {
+ 2| x = arg: assert arg == "y"; 123;
+ | ^
+ 3|
diff --git a/tests/lang/eval-fail-bad-antiquote-1.err.exp b/tests/lang/eval-fail-bad-antiquote-1.err.exp
new file mode 100644
index 000000000..cf94f53bc
--- /dev/null
+++ b/tests/lang/eval-fail-bad-antiquote-1.err.exp
@@ -0,0 +1,10 @@
+error:
+ … while evaluating a path segment
+
+ at /pwd/lang/eval-fail-bad-antiquote-1.nix:1:2:
+
+ 1| "${x: x}"
+ | ^
+ 2|
+
+ error: cannot coerce a function to a string
diff --git a/tests/lang/eval-fail-bad-antiquote-2.err.exp b/tests/lang/eval-fail-bad-antiquote-2.err.exp
new file mode 100644
index 000000000..c8fe39d12
--- /dev/null
+++ b/tests/lang/eval-fail-bad-antiquote-2.err.exp
@@ -0,0 +1 @@
+error: operation 'addToStoreFromDump' is not supported by store 'dummy'
diff --git a/tests/lang/eval-fail-bad-antiquote-3.err.exp b/tests/lang/eval-fail-bad-antiquote-3.err.exp
new file mode 100644
index 000000000..fbefbc826
--- /dev/null
+++ b/tests/lang/eval-fail-bad-antiquote-3.err.exp
@@ -0,0 +1,10 @@
+error:
+ … while evaluating a path segment
+
+ at /pwd/lang/eval-fail-bad-antiquote-3.nix:1:3:
+
+ 1| ''${x: x}''
+ | ^
+ 2|
+
+ error: cannot coerce a function to a string
diff --git a/tests/lang/eval-fail-bad-string-interpolation-1.err.exp b/tests/lang/eval-fail-bad-string-interpolation-1.err.exp
new file mode 100644
index 000000000..eb73e9a52
--- /dev/null
+++ b/tests/lang/eval-fail-bad-string-interpolation-1.err.exp
@@ -0,0 +1,10 @@
+error:
+ … while evaluating a path segment
+
+ at /pwd/lang/eval-fail-bad-string-interpolation-1.nix:1:2:
+
+ 1| "${x: x}"
+ | ^
+ 2|
+
+ error: cannot coerce a function to a string
diff --git a/tests/lang/eval-fail-bad-antiquote-1.nix b/tests/lang/eval-fail-bad-string-interpolation-1.nix
index ffe9c983c..ffe9c983c 100644
--- a/tests/lang/eval-fail-bad-antiquote-1.nix
+++ b/tests/lang/eval-fail-bad-string-interpolation-1.nix
diff --git a/tests/lang/eval-fail-bad-string-interpolation-2.err.exp b/tests/lang/eval-fail-bad-string-interpolation-2.err.exp
new file mode 100644
index 000000000..c8fe39d12
--- /dev/null
+++ b/tests/lang/eval-fail-bad-string-interpolation-2.err.exp
@@ -0,0 +1 @@
+error: operation 'addToStoreFromDump' is not supported by store 'dummy'
diff --git a/tests/lang/eval-fail-bad-antiquote-2.nix b/tests/lang/eval-fail-bad-string-interpolation-2.nix
index 3745235ce..3745235ce 100644
--- a/tests/lang/eval-fail-bad-antiquote-2.nix
+++ b/tests/lang/eval-fail-bad-string-interpolation-2.nix
diff --git a/tests/lang/eval-fail-bad-string-interpolation-3.err.exp b/tests/lang/eval-fail-bad-string-interpolation-3.err.exp
new file mode 100644
index 000000000..ac14f329b
--- /dev/null
+++ b/tests/lang/eval-fail-bad-string-interpolation-3.err.exp
@@ -0,0 +1,10 @@
+error:
+ … while evaluating a path segment
+
+ at /pwd/lang/eval-fail-bad-string-interpolation-3.nix:1:3:
+
+ 1| ''${x: x}''
+ | ^
+ 2|
+
+ error: cannot coerce a function to a string
diff --git a/tests/lang/eval-fail-bad-antiquote-3.nix b/tests/lang/eval-fail-bad-string-interpolation-3.nix
index 65b9d4f50..65b9d4f50 100644
--- a/tests/lang/eval-fail-bad-antiquote-3.nix
+++ b/tests/lang/eval-fail-bad-string-interpolation-3.nix
diff --git a/tests/lang/eval-fail-blackhole.err.exp b/tests/lang/eval-fail-blackhole.err.exp
new file mode 100644
index 000000000..f0618d8ac
--- /dev/null
+++ b/tests/lang/eval-fail-blackhole.err.exp
@@ -0,0 +1,18 @@
+error:
+ … while evaluating the attribute 'body'
+
+ at /pwd/lang/eval-fail-blackhole.nix:2:3:
+
+ 1| let {
+ 2| body = x;
+ | ^
+ 3| x = y;
+
+ error: infinite recursion encountered
+
+ at /pwd/lang/eval-fail-blackhole.nix:3:7:
+
+ 2| body = x;
+ 3| x = y;
+ | ^
+ 4| y = x;
diff --git a/tests/lang/eval-fail-deepseq.err.exp b/tests/lang/eval-fail-deepseq.err.exp
new file mode 100644
index 000000000..5e204ba73
--- /dev/null
+++ b/tests/lang/eval-fail-deepseq.err.exp
@@ -0,0 +1,26 @@
+error:
+ … while calling the 'deepSeq' builtin
+
+ at /pwd/lang/eval-fail-deepseq.nix:1:1:
+
+ 1| builtins.deepSeq { x = abort "foo"; } 456
+ | ^
+ 2|
+
+ … while evaluating the attribute 'x'
+
+ at /pwd/lang/eval-fail-deepseq.nix:1:20:
+
+ 1| builtins.deepSeq { x = abort "foo"; } 456
+ | ^
+ 2|
+
+ … while calling the 'abort' builtin
+
+ at /pwd/lang/eval-fail-deepseq.nix:1:24:
+
+ 1| builtins.deepSeq { x = abort "foo"; } 456
+ | ^
+ 2|
+
+ error: evaluation aborted with the following error message: 'foo'
diff --git a/tests/lang/eval-fail-dup-dynamic-attrs.err.exp b/tests/lang/eval-fail-dup-dynamic-attrs.err.exp
new file mode 100644
index 000000000..e01f8e6d0
--- /dev/null
+++ b/tests/lang/eval-fail-dup-dynamic-attrs.err.exp
@@ -0,0 +1,8 @@
+error: dynamic attribute 'b' already defined at /pwd/lang/eval-fail-dup-dynamic-attrs.nix:2:11
+
+ at /pwd/lang/eval-fail-dup-dynamic-attrs.nix:3:11:
+
+ 2| set = { "${"" + "b"}" = 1; };
+ 3| set = { "${"b" + ""}" = 2; };
+ | ^
+ 4| }
diff --git a/tests/lang/eval-fail-dup-dynamic-attrs.nix b/tests/lang/eval-fail-dup-dynamic-attrs.nix
new file mode 100644
index 000000000..7ea17f6c8
--- /dev/null
+++ b/tests/lang/eval-fail-dup-dynamic-attrs.nix
@@ -0,0 +1,4 @@
+{
+ set = { "${"" + "b"}" = 1; };
+ set = { "${"b" + ""}" = 2; };
+}
diff --git a/tests/lang/eval-fail-foldlStrict-strict-op-application.err.exp b/tests/lang/eval-fail-foldlStrict-strict-op-application.err.exp
new file mode 100644
index 000000000..0069285fb
--- /dev/null
+++ b/tests/lang/eval-fail-foldlStrict-strict-op-application.err.exp
@@ -0,0 +1,38 @@
+error:
+ … while calling the 'foldl'' builtin
+
+ at /pwd/lang/eval-fail-foldlStrict-strict-op-application.nix:2:1:
+
+ 1| # Tests that the result of applying op is forced even if the value is never used
+ 2| builtins.foldl'
+ | ^
+ 3| (_: f: f null)
+
+ … while calling anonymous lambda
+
+ at /pwd/lang/eval-fail-foldlStrict-strict-op-application.nix:3:7:
+
+ 2| builtins.foldl'
+ 3| (_: f: f null)
+ | ^
+ 4| null
+
+ … from call site
+
+ at /pwd/lang/eval-fail-foldlStrict-strict-op-application.nix:3:10:
+
+ 2| builtins.foldl'
+ 3| (_: f: f null)
+ | ^
+ 4| null
+
+ … while calling anonymous lambda
+
+ at /pwd/lang/eval-fail-foldlStrict-strict-op-application.nix:5:6:
+
+ 4| null
+ 5| [ (_: throw "Not the final value, but is still forced!") (_: 23) ]
+ | ^
+ 6|
+
+ error: Not the final value, but is still forced!
diff --git a/tests/lang/eval-fail-fromTOML-timestamps.err.exp b/tests/lang/eval-fail-fromTOML-timestamps.err.exp
new file mode 100644
index 000000000..f6bd19f5a
--- /dev/null
+++ b/tests/lang/eval-fail-fromTOML-timestamps.err.exp
@@ -0,0 +1,12 @@
+error:
+ … while calling the 'fromTOML' builtin
+
+ at /pwd/lang/eval-fail-fromTOML-timestamps.nix:1:1:
+
+ 1| builtins.fromTOML ''
+ | ^
+ 2| key = "value"
+
+ error: while parsing a TOML string: Dates and times are not supported
+
+ at «none»:0: (source not available)
diff --git a/tests/lang/eval-fail-fromTOML-timestamps.nix b/tests/lang/eval-fail-fromTOML-timestamps.nix
new file mode 100644
index 000000000..74cff9470
--- /dev/null
+++ b/tests/lang/eval-fail-fromTOML-timestamps.nix
@@ -0,0 +1,130 @@
+builtins.fromTOML ''
+ key = "value"
+ bare_key = "value"
+ bare-key = "value"
+ 1234 = "value"
+
+ "127.0.0.1" = "value"
+ "character encoding" = "value"
+ "ʎǝʞ" = "value"
+ 'key2' = "value"
+ 'quoted "value"' = "value"
+
+ name = "Orange"
+
+ physical.color = "orange"
+ physical.shape = "round"
+ site."google.com" = true
+
+ # This is legal according to the spec, but cpptoml doesn't handle it.
+ #a.b.c = 1
+ #a.d = 2
+
+ str = "I'm a string. \"You can quote me\". Name\tJos\u00E9\nLocation\tSF."
+
+ int1 = +99
+ int2 = 42
+ int3 = 0
+ int4 = -17
+ int5 = 1_000
+ int6 = 5_349_221
+ int7 = 1_2_3_4_5
+
+ hex1 = 0xDEADBEEF
+ hex2 = 0xdeadbeef
+ hex3 = 0xdead_beef
+
+ oct1 = 0o01234567
+ oct2 = 0o755
+
+ bin1 = 0b11010110
+
+ flt1 = +1.0
+ flt2 = 3.1415
+ flt3 = -0.01
+ flt4 = 5e+22
+ flt5 = 1e6
+ flt6 = -2E-2
+ flt7 = 6.626e-34
+ flt8 = 9_224_617.445_991_228_313
+
+ bool1 = true
+ bool2 = false
+
+ odt1 = 1979-05-27T07:32:00Z
+ odt2 = 1979-05-27T00:32:00-07:00
+ odt3 = 1979-05-27T00:32:00.999999-07:00
+ odt4 = 1979-05-27 07:32:00Z
+ ldt1 = 1979-05-27T07:32:00
+ ldt2 = 1979-05-27T00:32:00.999999
+ ld1 = 1979-05-27
+ lt1 = 07:32:00
+ lt2 = 00:32:00.999999
+
+ arr1 = [ 1, 2, 3 ]
+ arr2 = [ "red", "yellow", "green" ]
+ arr3 = [ [ 1, 2 ], [3, 4, 5] ]
+ arr4 = [ "all", 'strings', """are the same""", ''''type'''']
+ arr5 = [ [ 1, 2 ], ["a", "b", "c"] ]
+
+ arr7 = [
+ 1, 2, 3
+ ]
+
+ arr8 = [
+ 1,
+ 2, # this is ok
+ ]
+
+ [table-1]
+ key1 = "some string"
+ key2 = 123
+
+
+ [table-2]
+ key1 = "another string"
+ key2 = 456
+
+ [dog."tater.man"]
+ type.name = "pug"
+
+ [a.b.c]
+ [ d.e.f ]
+ [ g . h . i ]
+ [ j . "ʞ" . 'l' ]
+ [x.y.z.w]
+
+ name = { first = "Tom", last = "Preston-Werner" }
+ point = { x = 1, y = 2 }
+ animal = { type.name = "pug" }
+
+ [[products]]
+ name = "Hammer"
+ sku = 738594937
+
+ [[products]]
+
+ [[products]]
+ name = "Nail"
+ sku = 284758393
+ color = "gray"
+
+ [[fruit]]
+ name = "apple"
+
+ [fruit.physical]
+ color = "red"
+ shape = "round"
+
+ [[fruit.variety]]
+ name = "red delicious"
+
+ [[fruit.variety]]
+ name = "granny smith"
+
+ [[fruit]]
+ name = "banana"
+
+ [[fruit.variety]]
+ name = "plantain"
+''
diff --git a/tests/lang/eval-fail-hashfile-missing.err.exp b/tests/lang/eval-fail-hashfile-missing.err.exp
new file mode 100644
index 000000000..8e77dec1e
--- /dev/null
+++ b/tests/lang/eval-fail-hashfile-missing.err.exp
@@ -0,0 +1,19 @@
+error:
+ … while calling the 'toString' builtin
+
+ at /pwd/lang/eval-fail-hashfile-missing.nix:4:3:
+
+ 3| in
+ 4| toString (builtins.concatLists (map (hash: map (builtins.hashFile hash) paths) ["md5" "sha1" "sha256" "sha512"]))
+ | ^
+ 5|
+
+ … while evaluating the first argument passed to builtins.toString
+
+ at «none»:0: (source not available)
+
+ … while calling the 'hashFile' builtin
+
+ at «none»:0: (source not available)
+
+ error: opening file '/pwd/lang/this-file-is-definitely-not-there-7392097': No such file or directory
diff --git a/tests/lang/eval-fail-list.err.exp b/tests/lang/eval-fail-list.err.exp
new file mode 100644
index 000000000..24d682118
--- /dev/null
+++ b/tests/lang/eval-fail-list.err.exp
@@ -0,0 +1,10 @@
+error:
+ … while evaluating one of the elements to concatenate
+
+ at /pwd/lang/eval-fail-list.nix:1:2:
+
+ 1| 8++1
+ | ^
+ 2|
+
+ error: value is an integer while a list was expected
diff --git a/tests/lang/eval-fail-list.nix b/tests/lang/eval-fail-list.nix
new file mode 100644
index 000000000..fa749f2f7
--- /dev/null
+++ b/tests/lang/eval-fail-list.nix
@@ -0,0 +1 @@
+8++1
diff --git a/tests/lang/eval-fail-missing-arg.err.exp b/tests/lang/eval-fail-missing-arg.err.exp
new file mode 100644
index 000000000..61fabf0d5
--- /dev/null
+++ b/tests/lang/eval-fail-missing-arg.err.exp
@@ -0,0 +1,16 @@
+error:
+ … from call site
+
+ at /pwd/lang/eval-fail-missing-arg.nix:1:1:
+
+ 1| ({x, y, z}: x + y + z) {x = "foo"; z = "bar";}
+ | ^
+ 2|
+
+ error: function 'anonymous lambda' called without required argument 'y'
+
+ at /pwd/lang/eval-fail-missing-arg.nix:1:2:
+
+ 1| ({x, y, z}: x + y + z) {x = "foo"; z = "bar";}
+ | ^
+ 2|
diff --git a/tests/lang/eval-fail-nonexist-path.err.exp b/tests/lang/eval-fail-nonexist-path.err.exp
new file mode 100644
index 000000000..c8fe39d12
--- /dev/null
+++ b/tests/lang/eval-fail-nonexist-path.err.exp
@@ -0,0 +1 @@
+error: operation 'addToStoreFromDump' is not supported by store 'dummy'
diff --git a/tests/lang/eval-fail-path-slash.err.exp b/tests/lang/eval-fail-path-slash.err.exp
new file mode 100644
index 000000000..f0011c97f
--- /dev/null
+++ b/tests/lang/eval-fail-path-slash.err.exp
@@ -0,0 +1,8 @@
+error: path has a trailing slash
+
+ at /pwd/lang/eval-fail-path-slash.nix:6:12:
+
+ 5| # and https://nixos.org/nix-dev/2016-June/020829.html
+ 6| /nix/store/
+ | ^
+ 7|
diff --git a/tests/lang/eval-fail-recursion.err.exp b/tests/lang/eval-fail-recursion.err.exp
new file mode 100644
index 000000000..af64133cb
--- /dev/null
+++ b/tests/lang/eval-fail-recursion.err.exp
@@ -0,0 +1,16 @@
+error:
+ … in the right operand of the update (//) operator
+
+ at /pwd/lang/eval-fail-recursion.nix:1:12:
+
+ 1| let a = {} // a; in a.foo
+ | ^
+ 2|
+
+ error: infinite recursion encountered
+
+ at /pwd/lang/eval-fail-recursion.nix:1:15:
+
+ 1| let a = {} // a; in a.foo
+ | ^
+ 2|
diff --git a/tests/lang/eval-fail-recursion.nix b/tests/lang/eval-fail-recursion.nix
new file mode 100644
index 000000000..075b5ed06
--- /dev/null
+++ b/tests/lang/eval-fail-recursion.nix
@@ -0,0 +1 @@
+let a = {} // a; in a.foo
diff --git a/tests/lang/eval-fail-remove.err.exp b/tests/lang/eval-fail-remove.err.exp
new file mode 100644
index 000000000..e82cdac98
--- /dev/null
+++ b/tests/lang/eval-fail-remove.err.exp
@@ -0,0 +1,19 @@
+error:
+ … while evaluating the attribute 'body'
+
+ at /pwd/lang/eval-fail-remove.nix:4:3:
+
+ 3|
+ 4| body = (removeAttrs attrs ["x"]).x;
+ | ^
+ 5| }
+
+ error: attribute 'x' missing
+
+ at /pwd/lang/eval-fail-remove.nix:4:10:
+
+ 3|
+ 4| body = (removeAttrs attrs ["x"]).x;
+ | ^
+ 5| }
+ Did you mean y?
diff --git a/tests/lang/eval-fail-scope-5.err.exp b/tests/lang/eval-fail-scope-5.err.exp
new file mode 100644
index 000000000..22b6166f8
--- /dev/null
+++ b/tests/lang/eval-fail-scope-5.err.exp
@@ -0,0 +1,36 @@
+error:
+ … while evaluating the attribute 'body'
+
+ at /pwd/lang/eval-fail-scope-5.nix:8:3:
+
+ 7|
+ 8| body = f {};
+ | ^
+ 9|
+
+ … from call site
+
+ at /pwd/lang/eval-fail-scope-5.nix:8:10:
+
+ 7|
+ 8| body = f {};
+ | ^
+ 9|
+
+ … while calling 'f'
+
+ at /pwd/lang/eval-fail-scope-5.nix:6:7:
+
+ 5|
+ 6| f = {x ? y, y ? x}: x + y;
+ | ^
+ 7|
+
+ error: infinite recursion encountered
+
+ at /pwd/lang/eval-fail-scope-5.nix:6:12:
+
+ 5|
+ 6| f = {x ? y, y ? x}: x + y;
+ | ^
+ 7|
diff --git a/tests/lang/eval-fail-seq.err.exp b/tests/lang/eval-fail-seq.err.exp
new file mode 100644
index 000000000..33a7e9491
--- /dev/null
+++ b/tests/lang/eval-fail-seq.err.exp
@@ -0,0 +1,18 @@
+error:
+ … while calling the 'seq' builtin
+
+ at /pwd/lang/eval-fail-seq.nix:1:1:
+
+ 1| builtins.seq (abort "foo") 2
+ | ^
+ 2|
+
+ … while calling the 'abort' builtin
+
+ at /pwd/lang/eval-fail-seq.nix:1:15:
+
+ 1| builtins.seq (abort "foo") 2
+ | ^
+ 2|
+
+ error: evaluation aborted with the following error message: 'foo'
diff --git a/tests/lang/eval-fail-set-override.err.exp b/tests/lang/eval-fail-set-override.err.exp
new file mode 100644
index 000000000..beb29d678
--- /dev/null
+++ b/tests/lang/eval-fail-set-override.err.exp
@@ -0,0 +1,6 @@
+error:
+ … while evaluating the `__overrides` attribute
+
+ at «none»:0: (source not available)
+
+ error: value is an integer while a set was expected
diff --git a/tests/lang/eval-fail-set-override.nix b/tests/lang/eval-fail-set-override.nix
new file mode 100644
index 000000000..03551c186
--- /dev/null
+++ b/tests/lang/eval-fail-set-override.nix
@@ -0,0 +1 @@
+rec { __overrides = 1; }
diff --git a/tests/lang/eval-fail-set.err.exp b/tests/lang/eval-fail-set.err.exp
new file mode 100644
index 000000000..0d0140508
--- /dev/null
+++ b/tests/lang/eval-fail-set.err.exp
@@ -0,0 +1,7 @@
+error: undefined variable 'x'
+
+ at /pwd/lang/eval-fail-set.nix:1:3:
+
+ 1| 8.x
+ | ^
+ 2|
diff --git a/tests/lang/eval-fail-set.nix b/tests/lang/eval-fail-set.nix
new file mode 100644
index 000000000..c6b7980b6
--- /dev/null
+++ b/tests/lang/eval-fail-set.nix
@@ -0,0 +1 @@
+8.x
diff --git a/tests/lang/eval-fail-substring.err.exp b/tests/lang/eval-fail-substring.err.exp
new file mode 100644
index 000000000..dc26a00bd
--- /dev/null
+++ b/tests/lang/eval-fail-substring.err.exp
@@ -0,0 +1,12 @@
+error:
+ … while calling the 'substring' builtin
+
+ at /pwd/lang/eval-fail-substring.nix:1:1:
+
+ 1| builtins.substring (builtins.sub 0 1) 1 "x"
+ | ^
+ 2|
+
+ error: negative start position in 'substring'
+
+ at «none»:0: (source not available)
diff --git a/tests/lang/eval-fail-to-path.err.exp b/tests/lang/eval-fail-to-path.err.exp
new file mode 100644
index 000000000..43ed2bdfc
--- /dev/null
+++ b/tests/lang/eval-fail-to-path.err.exp
@@ -0,0 +1,14 @@
+error:
+ … while calling the 'toPath' builtin
+
+ at /pwd/lang/eval-fail-to-path.nix:1:1:
+
+ 1| builtins.toPath "foo/bar"
+ | ^
+ 2|
+
+ … while evaluating the first argument passed to builtins.toPath
+
+ at «none»:0: (source not available)
+
+ error: string 'foo/bar' doesn't represent an absolute path
diff --git a/tests/lang/eval-fail-toJSON.err.exp b/tests/lang/eval-fail-toJSON.err.exp
new file mode 100644
index 000000000..4e618c203
--- /dev/null
+++ b/tests/lang/eval-fail-toJSON.err.exp
@@ -0,0 +1,57 @@
+error:
+ … while calling the 'toJSON' builtin
+
+ at /pwd/lang/eval-fail-toJSON.nix:1:1:
+
+ 1| builtins.toJSON {
+ | ^
+ 2| a.b = [
+
+ … while evaluating attribute 'a'
+
+ at /pwd/lang/eval-fail-toJSON.nix:2:3:
+
+ 1| builtins.toJSON {
+ 2| a.b = [
+ | ^
+ 3| true
+
+ … while evaluating attribute 'b'
+
+ at /pwd/lang/eval-fail-toJSON.nix:2:3:
+
+ 1| builtins.toJSON {
+ 2| a.b = [
+ | ^
+ 3| true
+
+ … while evaluating list element at index 3
+
+ … while evaluating attribute 'c'
+
+ at /pwd/lang/eval-fail-toJSON.nix:7:7:
+
+ 6| {
+ 7| c.d = throw "hah no";
+ | ^
+ 8| }
+
+ … while evaluating attribute 'd'
+
+ at /pwd/lang/eval-fail-toJSON.nix:7:7:
+
+ 6| {
+ 7| c.d = throw "hah no";
+ | ^
+ 8| }
+
+ … while calling the 'throw' builtin
+
+ at /pwd/lang/eval-fail-toJSON.nix:7:13:
+
+ 6| {
+ 7| c.d = throw "hah no";
+ | ^
+ 8| }
+
+ error: hah no
diff --git a/tests/lang/eval-fail-toJSON.nix b/tests/lang/eval-fail-toJSON.nix
new file mode 100644
index 000000000..8112e1c1f
--- /dev/null
+++ b/tests/lang/eval-fail-toJSON.nix
@@ -0,0 +1,10 @@
+builtins.toJSON {
+ a.b = [
+ true
+ false
+ "it's a bird"
+ {
+ c.d = throw "hah no";
+ }
+ ];
+}
diff --git a/tests/lang/eval-fail-undeclared-arg.err.exp b/tests/lang/eval-fail-undeclared-arg.err.exp
new file mode 100644
index 000000000..30db743c7
--- /dev/null
+++ b/tests/lang/eval-fail-undeclared-arg.err.exp
@@ -0,0 +1,17 @@
+error:
+ … from call site
+
+ at /pwd/lang/eval-fail-undeclared-arg.nix:1:1:
+
+ 1| ({x, z}: x + z) {x = "foo"; y = "bla"; z = "bar";}
+ | ^
+ 2|
+
+ error: function 'anonymous lambda' called with unexpected argument 'y'
+
+ at /pwd/lang/eval-fail-undeclared-arg.nix:1:2:
+
+ 1| ({x, z}: x + z) {x = "foo"; y = "bla"; z = "bar";}
+ | ^
+ 2|
+ Did you mean one of x or z?
diff --git a/tests/lang/eval-okay-flake-ref-to-string.exp b/tests/lang/eval-okay-flake-ref-to-string.exp
new file mode 100644
index 000000000..110f8442d
--- /dev/null
+++ b/tests/lang/eval-okay-flake-ref-to-string.exp
@@ -0,0 +1 @@
+"github:NixOS/nixpkgs/23.05?dir=lib"
diff --git a/tests/lang/eval-okay-flake-ref-to-string.nix b/tests/lang/eval-okay-flake-ref-to-string.nix
new file mode 100644
index 000000000..dbb4e5b2a
--- /dev/null
+++ b/tests/lang/eval-okay-flake-ref-to-string.nix
@@ -0,0 +1,7 @@
+builtins.flakeRefToString {
+ type = "github";
+ owner = "NixOS";
+ repo = "nixpkgs";
+ ref = "23.05";
+ dir = "lib";
+}
diff --git a/tests/lang/eval-okay-fromTOML-timestamps.exp b/tests/lang/eval-okay-fromTOML-timestamps.exp
new file mode 100644
index 000000000..08b3c69a6
--- /dev/null
+++ b/tests/lang/eval-okay-fromTOML-timestamps.exp
@@ -0,0 +1 @@
+{ "1234" = "value"; "127.0.0.1" = "value"; a = { b = { c = { }; }; }; arr1 = [ 1 2 3 ]; arr2 = [ "red" "yellow" "green" ]; arr3 = [ [ 1 2 ] [ 3 4 5 ] ]; arr4 = [ "all" "strings" "are the same" "type" ]; arr5 = [ [ 1 2 ] [ "a" "b" "c" ] ]; arr7 = [ 1 2 3 ]; arr8 = [ 1 2 ]; bare-key = "value"; bare_key = "value"; bin1 = 214; bool1 = true; bool2 = false; "character encoding" = "value"; d = { e = { f = { }; }; }; dog = { "tater.man" = { type = { name = "pug"; }; }; }; flt1 = 1; flt2 = 3.1415; flt3 = -0.01; flt4 = 5e+22; flt5 = 1e+06; flt6 = -0.02; flt7 = 6.626e-34; flt8 = 9.22462e+06; fruit = [ { name = "apple"; physical = { color = "red"; shape = "round"; }; variety = [ { name = "red delicious"; } { name = "granny smith"; } ]; } { name = "banana"; variety = [ { name = "plantain"; } ]; } ]; g = { h = { i = { }; }; }; hex1 = 3735928559; hex2 = 3735928559; hex3 = 3735928559; int1 = 99; int2 = 42; int3 = 0; int4 = -17; int5 = 1000; int6 = 5349221; int7 = 12345; j = { "ʞ" = { l = { }; }; }; key = "value"; key2 = "value"; ld1 = { _type = "timestamp"; value = "1979-05-27"; }; ldt1 = { _type = "timestamp"; value = "1979-05-27T07:32:00"; }; ldt2 = { _type = "timestamp"; value = "1979-05-27T00:32:00.999999"; }; lt1 = { _type = "timestamp"; value = "07:32:00"; }; lt2 = { _type = "timestamp"; value = "00:32:00.999999"; }; name = "Orange"; oct1 = 342391; oct2 = 493; odt1 = { _type = "timestamp"; value = "1979-05-27T07:32:00Z"; }; odt2 = { _type = "timestamp"; value = "1979-05-27T00:32:00-07:00"; }; odt3 = { _type = "timestamp"; value = "1979-05-27T00:32:00.999999-07:00"; }; odt4 = { _type = "timestamp"; value = "1979-05-27T07:32:00Z"; }; physical = { color = "orange"; shape = "round"; }; products = [ { name = "Hammer"; sku = 738594937; } { } { color = "gray"; name = "Nail"; sku = 284758393; } ]; "quoted \"value\"" = "value"; site = { "google.com" = true; }; str = "I'm a string. \"You can quote me\". Name\tJosé\nLocation\tSF."; table-1 = { key1 = "some string"; key2 = 123; }; table-2 = { key1 = "another string"; key2 = 456; }; x = { y = { z = { w = { animal = { type = { name = "pug"; }; }; name = { first = "Tom"; last = "Preston-Werner"; }; point = { x = 1; y = 2; }; }; }; }; }; "ʎǝʞ" = "value"; }
diff --git a/tests/lang/eval-okay-fromTOML-timestamps.flags b/tests/lang/eval-okay-fromTOML-timestamps.flags
new file mode 100644
index 000000000..9ed39dc6b
--- /dev/null
+++ b/tests/lang/eval-okay-fromTOML-timestamps.flags
@@ -0,0 +1 @@
+--extra-experimental-features parse-toml-timestamps
diff --git a/tests/lang/eval-okay-fromTOML-timestamps.nix b/tests/lang/eval-okay-fromTOML-timestamps.nix
new file mode 100644
index 000000000..74cff9470
--- /dev/null
+++ b/tests/lang/eval-okay-fromTOML-timestamps.nix
@@ -0,0 +1,130 @@
+builtins.fromTOML ''
+ key = "value"
+ bare_key = "value"
+ bare-key = "value"
+ 1234 = "value"
+
+ "127.0.0.1" = "value"
+ "character encoding" = "value"
+ "ʎǝʞ" = "value"
+ 'key2' = "value"
+ 'quoted "value"' = "value"
+
+ name = "Orange"
+
+ physical.color = "orange"
+ physical.shape = "round"
+ site."google.com" = true
+
+ # This is legal according to the spec, but cpptoml doesn't handle it.
+ #a.b.c = 1
+ #a.d = 2
+
+ str = "I'm a string. \"You can quote me\". Name\tJos\u00E9\nLocation\tSF."
+
+ int1 = +99
+ int2 = 42
+ int3 = 0
+ int4 = -17
+ int5 = 1_000
+ int6 = 5_349_221
+ int7 = 1_2_3_4_5
+
+ hex1 = 0xDEADBEEF
+ hex2 = 0xdeadbeef
+ hex3 = 0xdead_beef
+
+ oct1 = 0o01234567
+ oct2 = 0o755
+
+ bin1 = 0b11010110
+
+ flt1 = +1.0
+ flt2 = 3.1415
+ flt3 = -0.01
+ flt4 = 5e+22
+ flt5 = 1e6
+ flt6 = -2E-2
+ flt7 = 6.626e-34
+ flt8 = 9_224_617.445_991_228_313
+
+ bool1 = true
+ bool2 = false
+
+ odt1 = 1979-05-27T07:32:00Z
+ odt2 = 1979-05-27T00:32:00-07:00
+ odt3 = 1979-05-27T00:32:00.999999-07:00
+ odt4 = 1979-05-27 07:32:00Z
+ ldt1 = 1979-05-27T07:32:00
+ ldt2 = 1979-05-27T00:32:00.999999
+ ld1 = 1979-05-27
+ lt1 = 07:32:00
+ lt2 = 00:32:00.999999
+
+ arr1 = [ 1, 2, 3 ]
+ arr2 = [ "red", "yellow", "green" ]
+ arr3 = [ [ 1, 2 ], [3, 4, 5] ]
+ arr4 = [ "all", 'strings', """are the same""", ''''type'''']
+ arr5 = [ [ 1, 2 ], ["a", "b", "c"] ]
+
+ arr7 = [
+ 1, 2, 3
+ ]
+
+ arr8 = [
+ 1,
+ 2, # this is ok
+ ]
+
+ [table-1]
+ key1 = "some string"
+ key2 = 123
+
+
+ [table-2]
+ key1 = "another string"
+ key2 = 456
+
+ [dog."tater.man"]
+ type.name = "pug"
+
+ [a.b.c]
+ [ d.e.f ]
+ [ g . h . i ]
+ [ j . "ʞ" . 'l' ]
+ [x.y.z.w]
+
+ name = { first = "Tom", last = "Preston-Werner" }
+ point = { x = 1, y = 2 }
+ animal = { type.name = "pug" }
+
+ [[products]]
+ name = "Hammer"
+ sku = 738594937
+
+ [[products]]
+
+ [[products]]
+ name = "Nail"
+ sku = 284758393
+ color = "gray"
+
+ [[fruit]]
+ name = "apple"
+
+ [fruit.physical]
+ color = "red"
+ shape = "round"
+
+ [[fruit.variety]]
+ name = "red delicious"
+
+ [[fruit.variety]]
+ name = "granny smith"
+
+ [[fruit]]
+ name = "banana"
+
+ [[fruit.variety]]
+ name = "plantain"
+''
diff --git a/tests/lang/eval-okay-fromjson.nix b/tests/lang/eval-okay-fromjson.nix
index e1c0f86cc..4c526b9ae 100644
--- a/tests/lang/eval-okay-fromjson.nix
+++ b/tests/lang/eval-okay-fromjson.nix
@@ -11,9 +11,12 @@ builtins.fromJSON
"Width": 200,
"Height": 250
},
+ "Animated" : false,
+ "IDs": [116, 943, 234, 38793, true ,false,null, -100],
+ "Escapes": "\"\\\/\t\n\r\t",
"Subtitle" : false,
- "Latitude": 46.2051,
- "Longitude": 6.0723
+ "Latitude": 37.7668,
+ "Longitude": -122.3959
}
}
''
@@ -28,8 +31,11 @@ builtins.fromJSON
Width = 200;
Height = 250;
};
+ Animated = false;
+ IDs = [ 116 943 234 38793 true false null (0-100) ];
+ Escapes = "\"\\\/\t\n\r\t"; # supported in JSON but not Nix: \b\f
Subtitle = false;
- Latitude = 46.2051;
- Longitude = 6.0723;
+ Latitude = 37.7668;
+ Longitude = -122.3959;
};
}
diff --git a/tests/lang/eval-okay-merge-dynamic-attrs.exp b/tests/lang/eval-okay-merge-dynamic-attrs.exp
new file mode 100644
index 000000000..157d677ce
--- /dev/null
+++ b/tests/lang/eval-okay-merge-dynamic-attrs.exp
@@ -0,0 +1 @@
+{ set1 = { a = 1; b = 2; }; set2 = { a = 1; b = 2; }; set3 = { a = 1; b = 2; }; set4 = { a = 1; b = 2; }; }
diff --git a/tests/lang/eval-okay-merge-dynamic-attrs.nix b/tests/lang/eval-okay-merge-dynamic-attrs.nix
new file mode 100644
index 000000000..f459a554f
--- /dev/null
+++ b/tests/lang/eval-okay-merge-dynamic-attrs.nix
@@ -0,0 +1,13 @@
+{
+ set1 = { a = 1; };
+ set1 = { "${"b" + ""}" = 2; };
+
+ set2 = { "${"b" + ""}" = 2; };
+ set2 = { a = 1; };
+
+ set3.a = 1;
+ set3."${"b" + ""}" = 2;
+
+ set4."${"b" + ""}" = 2;
+ set4.a = 1;
+}
diff --git a/tests/lang/eval-okay-overrides.nix b/tests/lang/eval-okay-overrides.nix
index 358742b36..719bdc9c0 100644
--- a/tests/lang/eval-okay-overrides.nix
+++ b/tests/lang/eval-okay-overrides.nix
@@ -1,6 +1,6 @@
let
- overrides = { a = 2; };
+ overrides = { a = 2; b = 3; };
in (rec {
__overrides = overrides;
diff --git a/tests/lang/eval-okay-parse-flake-ref.exp b/tests/lang/eval-okay-parse-flake-ref.exp
new file mode 100644
index 000000000..fc17ba085
--- /dev/null
+++ b/tests/lang/eval-okay-parse-flake-ref.exp
@@ -0,0 +1 @@
+{ dir = "lib"; owner = "NixOS"; ref = "23.05"; repo = "nixpkgs"; type = "github"; }
diff --git a/tests/lang/eval-okay-parse-flake-ref.nix b/tests/lang/eval-okay-parse-flake-ref.nix
new file mode 100644
index 000000000..db4ed2742
--- /dev/null
+++ b/tests/lang/eval-okay-parse-flake-ref.nix
@@ -0,0 +1 @@
+ builtins.parseFlakeRef "github:NixOS/nixpkgs/23.05?dir=lib"
diff --git a/tests/lang/eval-okay-path-antiquotation.exp b/tests/lang/eval-okay-path-string-interpolation.exp
index 5b8ea0243..5b8ea0243 100644
--- a/tests/lang/eval-okay-path-antiquotation.exp
+++ b/tests/lang/eval-okay-path-string-interpolation.exp
diff --git a/tests/lang/eval-okay-path-antiquotation.nix b/tests/lang/eval-okay-path-string-interpolation.nix
index 497d7c1c7..497d7c1c7 100644
--- a/tests/lang/eval-okay-path-antiquotation.nix
+++ b/tests/lang/eval-okay-path-string-interpolation.nix
diff --git a/tests/lang/eval-okay-pathexists.nix b/tests/lang/eval-okay-pathexists.nix
index 50c28ee0c..e1246e370 100644
--- a/tests/lang/eval-okay-pathexists.nix
+++ b/tests/lang/eval-okay-pathexists.nix
@@ -1,4 +1,7 @@
-builtins.pathExists (builtins.toPath ./lib.nix)
+builtins.pathExists (./lib.nix)
+&& builtins.pathExists (builtins.toPath ./lib.nix)
+&& builtins.pathExists (builtins.toString ./lib.nix)
+&& !builtins.pathExists (builtins.toString ./lib.nix + "/")
&& builtins.pathExists (builtins.toPath (builtins.toString ./lib.nix))
&& !builtins.pathExists (builtins.toPath (builtins.toString ./bla.nix))
&& builtins.pathExists ./lib.nix
diff --git a/tests/lang/eval-okay-print.err.exp b/tests/lang/eval-okay-print.err.exp
new file mode 100644
index 000000000..3fc99be3e
--- /dev/null
+++ b/tests/lang/eval-okay-print.err.exp
@@ -0,0 +1 @@
+trace: [ <CODE> ]
diff --git a/tests/lang/eval-okay-print.exp b/tests/lang/eval-okay-print.exp
new file mode 100644
index 000000000..0d960fb70
--- /dev/null
+++ b/tests/lang/eval-okay-print.exp
@@ -0,0 +1 @@
+[ null <PRIMOP> <PRIMOP-APP> <LAMBDA> [ [ «repeated» ] ] ]
diff --git a/tests/lang/eval-okay-print.nix b/tests/lang/eval-okay-print.nix
new file mode 100644
index 000000000..d36ba4da3
--- /dev/null
+++ b/tests/lang/eval-okay-print.nix
@@ -0,0 +1 @@
+with builtins; trace [(1+1)] [ null toString (deepSeq "x") (a: a) (let x=[x]; in x) ]
diff --git a/tests/lang/eval-okay-replacestrings.exp b/tests/lang/eval-okay-replacestrings.exp
index 72e8274d8..eac67c5fe 100644
--- a/tests/lang/eval-okay-replacestrings.exp
+++ b/tests/lang/eval-okay-replacestrings.exp
@@ -1 +1 @@
-[ "faabar" "fbar" "fubar" "faboor" "fubar" "XaXbXcX" "X" "a_b" ]
+[ "faabar" "fbar" "fubar" "faboor" "fubar" "XaXbXcX" "X" "a_b" "fubar" ]
diff --git a/tests/lang/eval-okay-replacestrings.nix b/tests/lang/eval-okay-replacestrings.nix
index bd8031fc0..a803e6519 100644
--- a/tests/lang/eval-okay-replacestrings.nix
+++ b/tests/lang/eval-okay-replacestrings.nix
@@ -8,4 +8,5 @@ with builtins;
(replaceStrings [""] ["X"] "abc")
(replaceStrings [""] ["X"] "")
(replaceStrings ["-"] ["_"] "a-b")
+ (replaceStrings ["oo" "XX"] ["u" (throw "unreachable")] "foobar")
]
diff --git a/tests/lang/eval-okay-search-path.flags b/tests/lang/eval-okay-search-path.flags
index a28e68210..dfad1c611 100644
--- a/tests/lang/eval-okay-search-path.flags
+++ b/tests/lang/eval-okay-search-path.flags
@@ -1 +1 @@
--I lang/dir1 -I lang/dir2 -I dir5=lang/dir3 \ No newline at end of file
+-I lang/dir1 -I lang/dir2 -I dir5=lang/dir3
diff --git a/tests/lang/framework.sh b/tests/lang/framework.sh
new file mode 100644
index 000000000..516bff8ad
--- /dev/null
+++ b/tests/lang/framework.sh
@@ -0,0 +1,33 @@
+# Golden test support
+#
+# Test that the output of the given test matches what is expected. If
+# `_NIX_TEST_ACCEPT` is non-empty also update the expected output so
+# that next time the test succeeds.
+function diffAndAcceptInner() {
+ local -r testName=$1
+ local -r got="$2"
+ local -r expected="$3"
+
+ # Absence of expected file indicates empty output expected.
+ if test -e "$expected"; then
+ local -r expectedOrEmpty="$expected"
+ else
+ local -r expectedOrEmpty=lang/empty.exp
+ fi
+
+ # Diff so we get a nice message
+ if ! diff --unified "$got" "$expectedOrEmpty"; then
+ echo "FAIL: evaluation result of $testName not as expected"
+ badDiff=1
+ fi
+
+ # Update expected if `_NIX_TEST_ACCEPT` is non-empty.
+ if test -n "${_NIX_TEST_ACCEPT-}"; then
+ cp "$got" "$expected"
+ # Delete empty expected files to avoid bloating the repo with
+ # empty files.
+ if ! test -s "$expected"; then
+ rm "$expected"
+ fi
+ fi
+}
diff --git a/tests/lang/parse-fail-dup-attrs-1.err.exp b/tests/lang/parse-fail-dup-attrs-1.err.exp
new file mode 100644
index 000000000..4fe6b7a1f
--- /dev/null
+++ b/tests/lang/parse-fail-dup-attrs-1.err.exp
@@ -0,0 +1,7 @@
+error: attribute 'x' already defined at «stdin»:1:3
+
+ at «stdin»:3:3:
+
+ 2| y = 456;
+ 3| x = 789;
+ | ^
diff --git a/tests/lang/parse-fail-dup-attrs-2.err.exp b/tests/lang/parse-fail-dup-attrs-2.err.exp
new file mode 100644
index 000000000..3aba2891f
--- /dev/null
+++ b/tests/lang/parse-fail-dup-attrs-2.err.exp
@@ -0,0 +1,7 @@
+error: attribute 'x' already defined at «stdin»:9:5
+
+ at «stdin»:10:17:
+
+ 9| x = 789;
+ 10| inherit (as) x;
+ | ^
diff --git a/tests/lang/parse-fail-dup-attrs-3.err.exp b/tests/lang/parse-fail-dup-attrs-3.err.exp
new file mode 100644
index 000000000..3aba2891f
--- /dev/null
+++ b/tests/lang/parse-fail-dup-attrs-3.err.exp
@@ -0,0 +1,7 @@
+error: attribute 'x' already defined at «stdin»:9:5
+
+ at «stdin»:10:17:
+
+ 9| x = 789;
+ 10| inherit (as) x;
+ | ^
diff --git a/tests/lang/parse-fail-dup-attrs-4.err.exp b/tests/lang/parse-fail-dup-attrs-4.err.exp
new file mode 100644
index 000000000..ff68446a1
--- /dev/null
+++ b/tests/lang/parse-fail-dup-attrs-4.err.exp
@@ -0,0 +1,7 @@
+error: attribute 'services.ssh.port' already defined at «stdin»:2:3
+
+ at «stdin»:3:3:
+
+ 2| services.ssh.port = 22;
+ 3| services.ssh.port = 23;
+ | ^
diff --git a/tests/lang/parse-fail-dup-attrs-6.err.exp b/tests/lang/parse-fail-dup-attrs-6.err.exp
new file mode 100644
index 000000000..74823fc25
--- /dev/null
+++ b/tests/lang/parse-fail-dup-attrs-6.err.exp
@@ -0,0 +1 @@
+error: attribute ‘services.ssh’ at (string):3:3 already defined at (string):2:3
diff --git a/tests/lang/parse-fail-dup-attrs-7.err.exp b/tests/lang/parse-fail-dup-attrs-7.err.exp
new file mode 100644
index 000000000..512a499ca
--- /dev/null
+++ b/tests/lang/parse-fail-dup-attrs-7.err.exp
@@ -0,0 +1,7 @@
+error: attribute 'x' already defined at «stdin»:6:12
+
+ at «stdin»:7:12:
+
+ 6| inherit x;
+ 7| inherit x;
+ | ^
diff --git a/tests/lang/parse-fail-dup-formals.err.exp b/tests/lang/parse-fail-dup-formals.err.exp
new file mode 100644
index 000000000..1d566fb33
--- /dev/null
+++ b/tests/lang/parse-fail-dup-formals.err.exp
@@ -0,0 +1,6 @@
+error: duplicate formal function argument 'x'
+
+ at «stdin»:1:8:
+
+ 1| {x, y, x}: x
+ | ^
diff --git a/tests/lang/parse-fail-eof-in-string.err.exp b/tests/lang/parse-fail-eof-in-string.err.exp
new file mode 100644
index 000000000..f9fa72312
--- /dev/null
+++ b/tests/lang/parse-fail-eof-in-string.err.exp
@@ -0,0 +1,7 @@
+error: syntax error, unexpected end of file, expecting '"'
+
+ at «stdin»:3:5:
+
+ 2| # Note that this file must not end with a newline.
+ 3| a 1"$
+ | ^
diff --git a/tests/lang/parse-fail-mixed-nested-attrs1.err.exp b/tests/lang/parse-fail-mixed-nested-attrs1.err.exp
new file mode 100644
index 000000000..32f776795
--- /dev/null
+++ b/tests/lang/parse-fail-mixed-nested-attrs1.err.exp
@@ -0,0 +1,8 @@
+error: attribute 'z' already defined at «stdin»:3:16
+
+ at «stdin»:2:3:
+
+ 1| {
+ 2| x.z = 3;
+ | ^
+ 3| x = { y = 3; z = 3; };
diff --git a/tests/lang/parse-fail-mixed-nested-attrs2.err.exp b/tests/lang/parse-fail-mixed-nested-attrs2.err.exp
new file mode 100644
index 000000000..0437cd50c
--- /dev/null
+++ b/tests/lang/parse-fail-mixed-nested-attrs2.err.exp
@@ -0,0 +1,8 @@
+error: attribute 'y' already defined at «stdin»:3:9
+
+ at «stdin»:2:3:
+
+ 1| {
+ 2| x.y.y = 3;
+ | ^
+ 3| x = { y.y= 3; z = 3; };
diff --git a/tests/lang/parse-fail-patterns-1.err.exp b/tests/lang/parse-fail-patterns-1.err.exp
new file mode 100644
index 000000000..634a04aaa
--- /dev/null
+++ b/tests/lang/parse-fail-patterns-1.err.exp
@@ -0,0 +1,7 @@
+error: duplicate formal function argument 'args'
+
+ at «stdin»:1:1:
+
+ 1| args@{args, x, y, z}: x
+ | ^
+ 2|
diff --git a/tests/lang/parse-fail-regression-20060610.err.exp b/tests/lang/parse-fail-regression-20060610.err.exp
new file mode 100644
index 000000000..167d01e85
--- /dev/null
+++ b/tests/lang/parse-fail-regression-20060610.err.exp
@@ -0,0 +1,8 @@
+error: undefined variable 'gcc'
+
+ at «stdin»:8:12:
+
+ 7|
+ 8| body = ({
+ | ^
+ 9| inherit gcc;
diff --git a/tests/lang/parse-fail-undef-var-2.err.exp b/tests/lang/parse-fail-undef-var-2.err.exp
new file mode 100644
index 000000000..77c96bbd2
--- /dev/null
+++ b/tests/lang/parse-fail-undef-var-2.err.exp
@@ -0,0 +1,7 @@
+error: syntax error, unexpected ':', expecting '}'
+
+ at «stdin»:3:13:
+
+ 2|
+ 3| f = {x, y :
+ | ^
diff --git a/tests/lang/parse-fail-undef-var.err.exp b/tests/lang/parse-fail-undef-var.err.exp
new file mode 100644
index 000000000..48e88747f
--- /dev/null
+++ b/tests/lang/parse-fail-undef-var.err.exp
@@ -0,0 +1,7 @@
+error: undefined variable 'y'
+
+ at «stdin»:1:4:
+
+ 1| x: y
+ | ^
+ 2|
diff --git a/tests/lang/parse-fail-utf8.err.exp b/tests/lang/parse-fail-utf8.err.exp
new file mode 100644
index 000000000..6087479a3
--- /dev/null
+++ b/tests/lang/parse-fail-utf8.err.exp
@@ -0,0 +1,6 @@
+error: syntax error, unexpected invalid token, expecting end of file
+
+ at «stdin»:1:5:
+
+ 1| 123
+ | ^
diff --git a/tests/lang/parse-fail-uft8.nix b/tests/lang/parse-fail-utf8.nix
index 34948d48a..34948d48a 100644
--- a/tests/lang/parse-fail-uft8.nix
+++ b/tests/lang/parse-fail-utf8.nix
diff --git a/tests/lang/parse-okay-1.exp b/tests/lang/parse-okay-1.exp
new file mode 100644
index 000000000..d5ab5f18a
--- /dev/null
+++ b/tests/lang/parse-okay-1.exp
@@ -0,0 +1 @@
+({ x, y, z }: ((x + y) + z))
diff --git a/tests/lang/parse-okay-crlf.exp b/tests/lang/parse-okay-crlf.exp
new file mode 100644
index 000000000..4213609fc
--- /dev/null
+++ b/tests/lang/parse-okay-crlf.exp
@@ -0,0 +1 @@
+rec { foo = "multi\nline\n string\n test\r"; x = y; y = 123; z = 456; }
diff --git a/tests/lang/parse-okay-dup-attrs-5.exp b/tests/lang/parse-okay-dup-attrs-5.exp
new file mode 100644
index 000000000..88b0b036f
--- /dev/null
+++ b/tests/lang/parse-okay-dup-attrs-5.exp
@@ -0,0 +1 @@
+{ services = { ssh = { enable = true; port = 23; }; }; }
diff --git a/tests/lang/parse-okay-dup-attrs-6.exp b/tests/lang/parse-okay-dup-attrs-6.exp
new file mode 100644
index 000000000..88b0b036f
--- /dev/null
+++ b/tests/lang/parse-okay-dup-attrs-6.exp
@@ -0,0 +1 @@
+{ services = { ssh = { enable = true; port = 23; }; }; }
diff --git a/tests/lang/parse-okay-mixed-nested-attrs-1.exp b/tests/lang/parse-okay-mixed-nested-attrs-1.exp
new file mode 100644
index 000000000..89c66f760
--- /dev/null
+++ b/tests/lang/parse-okay-mixed-nested-attrs-1.exp
@@ -0,0 +1 @@
+{ x = { q = 3; y = 3; z = 3; }; }
diff --git a/tests/lang/parse-okay-mixed-nested-attrs-2.exp b/tests/lang/parse-okay-mixed-nested-attrs-2.exp
new file mode 100644
index 000000000..89c66f760
--- /dev/null
+++ b/tests/lang/parse-okay-mixed-nested-attrs-2.exp
@@ -0,0 +1 @@
+{ x = { q = 3; y = 3; z = 3; }; }
diff --git a/tests/lang/parse-okay-mixed-nested-attrs-3.exp b/tests/lang/parse-okay-mixed-nested-attrs-3.exp
new file mode 100644
index 000000000..b89a59734
--- /dev/null
+++ b/tests/lang/parse-okay-mixed-nested-attrs-3.exp
@@ -0,0 +1 @@
+{ services = { httpd = { enable = true; }; ssh = { enable = true; port = 123; }; }; }
diff --git a/tests/lang/parse-okay-regression-20041027.exp b/tests/lang/parse-okay-regression-20041027.exp
new file mode 100644
index 000000000..9df7219e4
--- /dev/null
+++ b/tests/lang/parse-okay-regression-20041027.exp
@@ -0,0 +1 @@
+({ fetchurl, stdenv }: ((stdenv).mkDerivation { name = "libXi-6.0.1"; src = (fetchurl { md5 = "7e935a42428d63a387b3c048be0f2756"; url = "http://freedesktop.org/~xlibs/release/libXi-6.0.1.tar.bz2"; }); }))
diff --git a/tests/lang/parse-okay-regression-751.exp b/tests/lang/parse-okay-regression-751.exp
new file mode 100644
index 000000000..e2ed886fe
--- /dev/null
+++ b/tests/lang/parse-okay-regression-751.exp
@@ -0,0 +1 @@
+(let const = (a: "const"); in ((const { x = "q"; })))
diff --git a/tests/lang/parse-okay-subversion.exp b/tests/lang/parse-okay-subversion.exp
new file mode 100644
index 000000000..4168ee8bf
--- /dev/null
+++ b/tests/lang/parse-okay-subversion.exp
@@ -0,0 +1 @@
+({ fetchurl, localServer ? false, httpServer ? false, sslSupport ? false, pythonBindings ? false, javaSwigBindings ? false, javahlBindings ? false, stdenv, openssl ? null, httpd ? null, db4 ? null, expat, swig ? null, j2sdk ? null }: assert (expat != null); assert (localServer -> (db4 != null)); assert (httpServer -> ((httpd != null) && ((httpd).expat == expat))); assert (sslSupport -> ((openssl != null) && (httpServer -> ((httpd).openssl == openssl)))); assert (pythonBindings -> ((swig != null) && (swig).pythonSupport)); assert (javaSwigBindings -> ((swig != null) && (swig).javaSupport)); assert (javahlBindings -> (j2sdk != null)); ((stdenv).mkDerivation { builder = /foo/bar; db4 = (if localServer then db4 else null); inherit expat ; inherit httpServer ; httpd = (if httpServer then httpd else null); j2sdk = (if javaSwigBindings then (swig).j2sdk else (if javahlBindings then j2sdk else null)); inherit javaSwigBindings ; inherit javahlBindings ; inherit localServer ; name = "subversion-1.1.1"; openssl = (if sslSupport then openssl else null); patches = (if javahlBindings then [ (/javahl.patch) ] else [ ]); python = (if pythonBindings then (swig).python else null); inherit pythonBindings ; src = (fetchurl { md5 = "a180c3fe91680389c210c99def54d9e0"; url = "http://subversion.tigris.org/tarballs/subversion-1.1.1.tar.bz2"; }); inherit sslSupport ; swig = (if (pythonBindings || javaSwigBindings) then swig else null); }))
diff --git a/tests/lang/parse-okay-url.exp b/tests/lang/parse-okay-url.exp
new file mode 100644
index 000000000..e5f0829b0
--- /dev/null
+++ b/tests/lang/parse-okay-url.exp
@@ -0,0 +1 @@
+[ ("x:x") ("https://svn.cs.uu.nl:12443/repos/trace/trunk") ("http://www2.mplayerhq.hu/MPlayer/releases/fonts/font-arial-iso-8859-1.tar.bz2") ("http://losser.st-lab.cs.uu.nl/~armijn/.nix/gcc-3.3.4-static-nix.tar.gz") ("http://fpdownload.macromedia.com/get/shockwave/flash/english/linux/7.0r25/install_flash_player_7_linux.tar.gz") ("https://ftp5.gwdg.de/pub/linux/archlinux/extra/os/x86_64/unzip-6.0-14-x86_64.pkg.tar.zst") ("ftp://ftp.gtk.org/pub/gtk/v1.2/gtk+-1.2.10.tar.gz") ]