about summary refs log tree commit diff
path: root/tvix/eval/src/tests/nix_tests/eval-okay-intersectAttrs.nix
diff options
context:
space:
mode:
authorsterni <sternenseemann@systemli.org>2023-06-14T15·36+0200
committerclbot <clbot@tvl.fyi>2023-06-15T19·28+0000
commit3b8c9ec9c871c50855bb6fe78859ff25590b616b (patch)
tree1bc9d54fd960aea5070ad2a2186e5c2a0cb8b4e8 /tvix/eval/src/tests/nix_tests/eval-okay-intersectAttrs.nix
parent9278a0cd16d952a7483f37faecdd60582a3e5138 (diff)
test(tvix/eval): update nix_tests suite to C++ Nix master r/6314
Adds new tests for foldl', intersectAttrs as well as fills in missing
.exp files.

New test cases we don't pass:

- fromTOML timestamp capabilities
- path antiquotation
- replaceStrings is lazier on C++ Nix master

The C++ Nix revision used is 7066d21a0ddb421967980094222c4bc1f5a0f45a.

Change-Id: Ic619c96e2d41e6c5ea6fa93f9402b12e564af3c5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8778
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/eval/src/tests/nix_tests/eval-okay-intersectAttrs.nix')
-rw-r--r--tvix/eval/src/tests/nix_tests/eval-okay-intersectAttrs.nix50
1 files changed, 50 insertions, 0 deletions
diff --git a/tvix/eval/src/tests/nix_tests/eval-okay-intersectAttrs.nix b/tvix/eval/src/tests/nix_tests/eval-okay-intersectAttrs.nix
new file mode 100644
index 000000000000..39d49938cc29
--- /dev/null
+++ b/tvix/eval/src/tests/nix_tests/eval-okay-intersectAttrs.nix
@@ -0,0 +1,50 @@
+let
+  alphabet =
+  { a = "a";
+    b = "b";
+    c = "c";
+    d = "d";
+    e = "e";
+    f = "f";
+    g = "g";
+    h = "h";
+    i = "i";
+    j = "j";
+    k = "k";
+    l = "l";
+    m = "m";
+    n = "n";
+    o = "o";
+    p = "p";
+    q = "q";
+    r = "r";
+    s = "s";
+    t = "t";
+    u = "u";
+    v = "v";
+    w = "w";
+    x = "x";
+    y = "y";
+    z = "z";
+  };
+  foo = {
+    inherit (alphabet) f o b a r z q u x;
+    aa = throw "aa";
+  };
+  alphabetFail = builtins.mapAttrs throw alphabet;
+in
+[ (builtins.intersectAttrs { a = abort "l1"; } { b = abort "r1"; })
+  (builtins.intersectAttrs { a = abort "l2"; } { a = 1; })
+  (builtins.intersectAttrs alphabetFail { a = 1; })
+  (builtins.intersectAttrs  { a = abort "laa"; } alphabet)
+  (builtins.intersectAttrs alphabetFail { m = 1; })
+  (builtins.intersectAttrs  { m = abort "lam"; } alphabet)
+  (builtins.intersectAttrs alphabetFail { n = 1; })
+  (builtins.intersectAttrs  { n = abort "lan"; } alphabet)
+  (builtins.intersectAttrs alphabetFail { n = 1; p = 2; })
+  (builtins.intersectAttrs  { n = abort "lan2"; p = abort "lap"; } alphabet)
+  (builtins.intersectAttrs alphabetFail { n = 1; p = 2; })
+  (builtins.intersectAttrs  { n = abort "lan2"; p = abort "lap"; } alphabet)
+  (builtins.intersectAttrs alphabetFail alphabet)
+  (builtins.intersectAttrs alphabet foo == builtins.intersectAttrs foo alphabet)
+]