aboutsummaryrefslogtreecommitdiffstats
path: root/test/testdata/eval-okay-strings-as-attrs-names.nix
diff options
context:
space:
mode:
Diffstat (limited to 'test/testdata/eval-okay-strings-as-attrs-names.nix')
-rw-r--r--test/testdata/eval-okay-strings-as-attrs-names.nix20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/testdata/eval-okay-strings-as-attrs-names.nix b/test/testdata/eval-okay-strings-as-attrs-names.nix
new file mode 100644
index 0000000..5e40928
--- /dev/null
+++ b/test/testdata/eval-okay-strings-as-attrs-names.nix
@@ -0,0 +1,20 @@
1let
2
3 attr = {
4 "key 1" = "test";
5 "key 2" = "caseok";
6 };
7
8 t1 = builtins.getAttr "key 1" attr;
9 t2 = attr."key 2";
10 t3 = attr ? "key 1";
11 t4 = builtins.attrNames { inherit (attr) "key 1"; };
12
13 # This is permitted, but there is currently no way to reference this
14 # variable.
15 "foo bar" = 1;
16
17in t1 == "test"
18 && t2 == "caseok"
19 && t3 == true
20 && t4 == ["key 1"]