diff options
| author | Silvan Mosberger <silvan.mosberger@tweag.io> | 2023-04-05 20:31:50 +0200 |
|---|---|---|
| committer | Silvan Mosberger <silvan.mosberger@tweag.io> | 2023-06-15 22:29:46 +0200 |
| commit | 592213ad3f4de2cf3a0f13ab8271122e5e9f9822 (patch) | |
| tree | 37b96530c9c7ca6eb3e862511043d1b9455a2b76 /lib/path/tests | |
| parent | lib.path.append: Add a law (diff) | |
| download | nixpkgs-592213ad3f4de2cf3a0f13ab8271122e5e9f9822.tar.gz | |
lib.path.hasPrefix: init
Diffstat (limited to 'lib/path/tests')
| -rw-r--r-- | lib/path/tests/unit.nix | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/path/tests/unit.nix b/lib/path/tests/unit.nix index 61c4ab4d6f2e..9c5b752cf64a 100644 --- a/lib/path/tests/unit.nix +++ b/lib/path/tests/unit.nix @@ -3,7 +3,7 @@ { libpath }: let lib = import libpath; - inherit (lib.path) append subpath; + inherit (lib.path) hasPrefix append subpath; cases = lib.runTests { # Test examples from the lib.path.append documentation @@ -40,6 +40,23 @@ let expected = false; }; + testHasPrefixExample1 = { + expr = hasPrefix /foo /foo/bar; + expected = true; + }; + testHasPrefixExample2 = { + expr = hasPrefix /foo /foo; + expected = true; + }; + testHasPrefixExample3 = { + expr = hasPrefix /foo/bar /foo; + expected = false; + }; + testHasPrefixExample4 = { + expr = hasPrefix /. /foo; + expected = true; + }; + # Test examples from the lib.path.subpath.isValid documentation testSubpathIsValidExample1 = { expr = subpath.isValid null; |
