summary refs log tree commit diff
path: root/lib/tests/misc.nix
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2018-08-15 00:13:32 +0200
committerProfpatsch <mail@profpatsch.de>2018-08-15 17:16:56 +0200
commitd817452e296b6578bbbf940cc6f899602792081e (patch)
treee45d9272b23059dffca41635c6599b31f6a26eea /lib/tests/misc.nix
parentb63ec6452156ee46e8e5bbf360e122b4083dfa77 (diff)
downloadnixpkgs-d817452e296b6578bbbf940cc6f899602792081e.tar
nixpkgs-d817452e296b6578bbbf940cc6f899602792081e.tar.gz
nixpkgs-d817452e296b6578bbbf940cc6f899602792081e.tar.bz2
nixpkgs-d817452e296b6578bbbf940cc6f899602792081e.tar.lz
nixpkgs-d817452e296b6578bbbf940cc6f899602792081e.tar.xz
nixpkgs-d817452e296b6578bbbf940cc6f899602792081e.tar.zst
nixpkgs-d817452e296b6578bbbf940cc6f899602792081e.zip
lib/recursiveUpdateUntil: add a test & release note for fix
Diffstat (limited to 'lib/tests/misc.nix')
-rw-r--r--lib/tests/misc.nix24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/tests/misc.nix b/lib/tests/misc.nix
index 3f2d742e788..cf99aca58c0 100644
--- a/lib/tests/misc.nix
+++ b/lib/tests/misc.nix
@@ -213,6 +213,30 @@ runTests {
   };
 
 
+# ATTRSETS
+
+  # code from the example
+  testRecursiveUpdateUntil = {
+    expr = recursiveUpdateUntil (path: l: r: path == ["foo"]) {
+      # first attribute set
+      foo.bar = 1;
+      foo.baz = 2;
+      bar = 3;
+    } {
+      #second attribute set
+      foo.bar = 1;
+      foo.quz = 2;
+      baz = 4;
+    };
+    expected = {
+      foo.bar = 1; # 'foo.*' from the second set
+      foo.quz = 2; #
+      bar = 3;     # 'bar' from the first set
+      baz = 4;     # 'baz' from the second set
+    };
+  };
+
+
 # GENERATORS
 # these tests assume attributes are converted to lists
 # in alphabetical order