From d817452e296b6578bbbf940cc6f899602792081e Mon Sep 17 00:00:00 2001 From: Profpatsch Date: Wed, 15 Aug 2018 00:13:32 +0200 Subject: lib/recursiveUpdateUntil: add a test & release note for fix --- lib/tests/misc.nix | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'lib/tests/misc.nix') diff --git a/lib/tests/misc.nix b/lib/tests/misc.nix index 3f2d742e7884..cf99aca58c09 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 -- cgit 1.4.1