summary refs log tree commit diff
path: root/lib/path/tests
diff options
context:
space:
mode:
authorRobert Hensing <roberth@users.noreply.github.com>2023-08-04 17:00:46 +0200
committerGitHub <noreply@github.com>2023-08-04 17:00:46 +0200
commit8fa169707fa055994fe60f194027629fee8e417a (patch)
tree22e7bdef086799cabf7409ad5ce10c1327cafca4 /lib/path/tests
parent35184dd3a52239b91a1eea5e430fa35c32139161 (diff)
parent407db583c54245136fe8e73976abadb7eb9fad80 (diff)
Merge pull request #242695 from tweag/lib.path.subpath.components
`lib.path.subpath.components`: init
Diffstat (limited to 'lib/path/tests')
-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 8bfb6f201219f..bad6560f13a98 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"