diff options
Diffstat (limited to 'nix')
-rw-r--r-- | nix/utils/tests/default.nix | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/nix/utils/tests/default.nix b/nix/utils/tests/default.nix index d8f38fde5cd6..366ddd7c9c94 100644 --- a/nix/utils/tests/default.nix +++ b/nix/utils/tests/default.nix @@ -13,6 +13,7 @@ let isDirectory isRegularFile isSymlink + storePathName ; assertUtilsPred = msg: act: exp: [ @@ -56,8 +57,23 @@ let (assertThrows "isSymlink throws on missing file" (isSymlink ./does-not-exist)) ]); + + cheddarStorePath = + builtins.unsafeDiscardStringContext depot.tools.cheddar.outPath; + + storePathNameTests = it "correctly gets the basename of a store path" [ + (assertEq "base name of a derivation" + (storePathName depot.tools.cheddar) depot.tools.cheddar.name) + (assertEq "base name of a store path string" + (storePathName cheddarStorePath) depot.tools.cheddar.name) + (assertEq "base name of a path within a store path" + (storePathName "${cheddarStorePath}/bin/cheddar") "cheddar") + (assertEq "base name of a path" + (storePathName ../default.nix) "default.nix") + ]; in runTestsuite "nix.utils" [ pathPredicates + storePathNameTests ] |