about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2014-01-06T15·27-0500
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-01-14T13·00+0100
commitf9913f4422d1317af3c6b5aff37ad18b78083eb5 (patch)
treeb18e070f5e266bfaff2abed726b767760412809f /tests
parente640d671443e291b3ca5cc0575919d6fcf14a157 (diff)
Allow "bare" dynamic attrs
Now, in addition to a."${b}".c, you can write a.${b}.c (applicable
wherever dynamic attributes are valid).

Signed-off-by: Shea Levy <shea@shealevy.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/lang/eval-okay-dynamic-attrs-bare.exp1
-rw-r--r--tests/lang/eval-okay-dynamic-attrs-bare.nix17
2 files changed, 18 insertions, 0 deletions
diff --git a/tests/lang/eval-okay-dynamic-attrs-bare.exp b/tests/lang/eval-okay-dynamic-attrs-bare.exp
new file mode 100644
index 000000000000..df8750afc036
--- /dev/null
+++ b/tests/lang/eval-okay-dynamic-attrs-bare.exp
@@ -0,0 +1 @@
+{ binds = true; hasAttrs = true; multiAttrs = true; recBinds = true; selectAttrs = true; selectOrAttrs = true; }
diff --git a/tests/lang/eval-okay-dynamic-attrs-bare.nix b/tests/lang/eval-okay-dynamic-attrs-bare.nix
new file mode 100644
index 000000000000..0dbe15e6384c
--- /dev/null
+++ b/tests/lang/eval-okay-dynamic-attrs-bare.nix
@@ -0,0 +1,17 @@
+let
+  aString = "a";
+
+  bString = "b";
+in {
+  hasAttrs = { a.b = null; } ? ${aString}.b;
+
+  selectAttrs = { a.b = true; }.a.${bString};
+
+  selectOrAttrs = { }.${aString} or true;
+
+  binds = { ${aString}."${bString}c" = true; }.a.bc;
+
+  recBinds = rec { ${bString} = a; a = true; }.b;
+
+  multiAttrs = { ${aString} = true; ${bString} = false; }.a;
+}