diff options
author | Silvan Mosberger <silvan.mosberger@tweag.io> | 2023-01-18 18:06:21 +0100 |
---|---|---|
committer | Silvan Mosberger <silvan.mosberger@tweag.io> | 2023-01-18 18:19:17 +0100 |
commit | 5c4f6161981917504c50b84864dcfd2f67dc037d (patch) | |
tree | a84c535cf64b5ed6c9e61e856419024f2189009d /lib/path/tests | |
parent | 0667ef5dd5cc7aa00e7d5ebf4391b7ee1d414a0c (diff) |
lib.path: Minor improvements
- Use isValid when possible instead of subpathInvalidReason: https://github.com/NixOS/nixpkgs/pull/209099#discussion_r1068714681 - Add documentation to function arguments - Use newlines for error messages: https://github.com/NixOS/nixpkgs/pull/208887#discussion_r1069737602 - Add short comments for the unit test groups: https://github.com/NixOS/nixpkgs/pull/208887#discussion_r1072913051 - Slight formatting improvement for laws: https://github.com/NixOS/nixpkgs/pull/209099#discussion_r1068707955
Diffstat (limited to 'lib/path/tests')
-rw-r--r-- | lib/path/tests/unit.nix | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/path/tests/unit.nix b/lib/path/tests/unit.nix index eccf3b7b1c33b..da2c950de9149 100644 --- a/lib/path/tests/unit.nix +++ b/lib/path/tests/unit.nix @@ -6,6 +6,7 @@ let inherit (lib.path) subpath; cases = lib.runTests { + # Test examples from the lib.path.subpath.isValid documentation testSubpathIsValidExample1 = { expr = subpath.isValid null; expected = false; @@ -30,6 +31,7 @@ let expr = subpath.isValid "./foo//bar/"; expected = true; }; + # Some extra tests testSubpathIsValidTwoDotsEnd = { expr = subpath.isValid "foo/.."; expected = false; @@ -71,6 +73,7 @@ let expected = true; }; + # Test examples from the lib.path.subpath.normalise documentation testSubpathNormaliseExample1 = { expr = subpath.normalise "foo//bar"; expected = "./foo/bar"; @@ -107,6 +110,7 @@ let expr = (builtins.tryEval (subpath.normalise "/foo")).success; expected = false; }; + # Some extra tests testSubpathNormaliseIsValidDots = { expr = subpath.normalise "./foo/.bar/.../baz...qux"; expected = "./foo/.bar/.../baz...qux"; |