Skip to content

Commit 0c0a41a

Browse files
Radvendiixokdviumpiegamesde
committed
tests: add tests for dynamic attribute in let and inherit
Regression tests for the previous commit. Co-authored-by: Sergei Zimmerman <sergei@zimmerman.foo> Co-authored-by: piegames <git@piegames.de>
1 parent 97abcda commit 0c0a41a

13 files changed

+68
-0
lines changed

maintainers/flake-module.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@
7979
# Not supported by nixfmt
8080
''^tests/functional/lang/eval-okay-deprecate-cursed-or\.nix$''
8181
''^tests/functional/lang/eval-okay-attrs5\.nix$''
82+
''^tests/functional/lang/eval-fail-dynamic-attrs-inherit\.nix$''
83+
''^tests/functional/lang/eval-fail-dynamic-attrs-inherit-2\.nix$''
8284

8385
# More syntax tests
8486
# These tests, or parts of them, should have been parse-* test cases.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
error: dynamic attributes not allowed in inherit
2+
at /pwd/lang/eval-fail-dynamic-attrs-inherit-2.nix:5:15:
3+
4| {
4+
5| inherit (a) ${"b" + ""};
5+
| ^
6+
6| }
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
let
2+
a.b = 1;
3+
in
4+
{
5+
inherit (a) ${"b" + ""};
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
error: dynamic attributes not allowed in inherit
2+
at /pwd/lang/eval-fail-dynamic-attrs-inherit.nix:5:11:
3+
4| {
4+
5| inherit ${"a" + ""};
5+
| ^
6+
6| }
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
let
2+
a = 1;
3+
in
4+
{
5+
inherit ${"a" + ""};
6+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
error: dynamic attributes not allowed in let
2+
at /pwd/lang/eval-fail-dynamic-attrs-let-2.nix:1:1:
3+
1| let
4+
| ^
5+
2| ${"${"a"}"} = 1;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
let
2+
${"${"a"}"} = 1;
3+
in
4+
a
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
error: dynamic attributes not allowed in let
2+
at /pwd/lang/eval-fail-dynamic-attrs-let-3.nix:1:1:
3+
1| let
4+
| ^
5+
2| "${"a"}" = 1;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
let
2+
"${"a"}" = 1;
3+
in
4+
a
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
error: dynamic attributes not allowed in let
2+
at /pwd/lang/eval-fail-dynamic-attrs-let.nix:1:1:
3+
1| let
4+
| ^
5+
2| ${"a" + ""} = 1;

0 commit comments

Comments
 (0)