summaryrefslogtreecommitdiff
path: root/lib/path/tests/unit.nix
diff options
context:
space:
mode:
Diffstat (limited to 'lib/path/tests/unit.nix')
-rw-r--r--lib/path/tests/unit.nix13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/path/tests/unit.nix b/lib/path/tests/unit.nix
index 8bfb6f201219..bad6560f13a9 100644
--- a/lib/path/tests/unit.nix
+++ b/lib/path/tests/unit.nix
@@ -238,6 +238,19 @@ let
expr = (builtins.tryEval (subpath.normalise "..")).success;
expected = false;
};
+
+ testSubpathComponentsExample1 = {
+ expr = subpath.components ".";
+ expected = [ ];
+ };
+ testSubpathComponentsExample2 = {
+ expr = subpath.components "./foo//bar/./baz/";
+ expected = [ "foo" "bar" "baz" ];
+ };
+ testSubpathComponentsExample3 = {
+ expr = (builtins.tryEval (subpath.components "/foo")).success;
+ expected = false;
+ };
};
in
if cases == [] then "Unit tests successful"