summaryrefslogtreecommitdiff
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
parentMerge pull request #246036 from ck3d/vdr-updates-2023-07 (diff)
parentlib/path/README.md: Justify returning subpaths (diff)
downloadnixpkgs-8fa169707fa055994fe60f194027629fee8e417a.tar.gz
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 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"