diff options
Diffstat (limited to 'lib/tests/misc.nix')
-rw-r--r-- | lib/tests/misc.nix | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/tests/misc.nix b/lib/tests/misc.nix index cf99aca58c09..1604fbb39cbb 100644 --- a/lib/tests/misc.nix +++ b/lib/tests/misc.nix @@ -112,7 +112,7 @@ runTests { storePathAppendix = isStorePath "${goodPath}/bin/python"; nonAbsolute = isStorePath (concatStrings (tail (stringToCharacters goodPath))); - asPath = isStorePath (builtins.toPath goodPath); + asPath = isStorePath (/. + goodPath); otherPath = isStorePath "/something/else"; otherVals = { attrset = isStorePath {}; @@ -236,6 +236,20 @@ runTests { }; }; + testOverrideExistingEmpty = { + expr = overrideExisting {} { a = 1; }; + expected = {}; + }; + + testOverrideExistingDisjoint = { + expr = overrideExisting { b = 2; } { a = 1; }; + expected = { b = 2; }; + }; + + testOverrideExistingOverride = { + expr = overrideExisting { a = 3; b = 2; } { a = 1; }; + expected = { a = 1; b = 2; }; + }; # GENERATORS # these tests assume attributes are converted to lists @@ -355,9 +369,10 @@ runTests { testToPretty = { expr = mapAttrs (const (generators.toPretty {})) rec { int = 42; + float = 0.1337; bool = true; string = ''fno"rd''; - path = /. + "/foo"; # toPath returns a string + path = /. + "/foo"; null_ = null; function = x: x; functionArgs = { arg ? 4, foo }: arg; @@ -367,6 +382,7 @@ runTests { }; expected = rec { int = "42"; + float = "~0.133700"; bool = "true"; string = ''"fno\"rd"''; path = "/foo"; |