diff options
Diffstat (limited to 'lib/tests/misc.nix')
-rw-r--r-- | lib/tests/misc.nix | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/tests/misc.nix b/lib/tests/misc.nix index 6f1d9039db802..3cb96c1b68bc2 100644 --- a/lib/tests/misc.nix +++ b/lib/tests/misc.nix @@ -64,6 +64,7 @@ let lists listToAttrs makeExtensible + makeIncludePath makeOverridable mapAttrs matchAttrs @@ -296,6 +297,35 @@ runTests { expected = "a\nb\nc\n"; }; + testMakeIncludePathWithPkgs = { + expr = (makeIncludePath [ + # makeIncludePath preferably selects the "dev" output + { dev.outPath = "/dev"; out.outPath = "/out"; outPath = "/default"; } + # "out" is used if "dev" is not found + { out.outPath = "/out"; outPath = "/default"; } + # And it returns the derivation directly if there's no "out" either + { outPath = "/default"; } + # Same if the output is specified explicitly, even if there's a "dev" + { dev.outPath = "/dev"; outPath = "/default"; outputSpecified = true; } + ]); + expected = "/dev/include:/out/include:/default/include:/default/include"; + }; + + testMakeIncludePathWithEmptyList = { + expr = (makeIncludePath [ ]); + expected = ""; + }; + + testMakeIncludePathWithOneString = { + expr = (makeIncludePath [ "/usr" ]); + expected = "/usr/include"; + }; + + testMakeIncludePathWithManyString = { + expr = (makeIncludePath [ "/usr" "/usr/local" ]); + expected = "/usr/include:/usr/local/include"; + }; + testReplicateString = { expr = strings.replicate 5 "hello"; expected = "hellohellohellohellohello"; |