2024-11-27 11:21:59 +01:00
|
|
|
# tests written for running with `nix-unit`
|
|
|
|
# https://github.com/nix-community/nix-unit
|
|
|
|
let
|
|
|
|
inherit (import ./. { }) lib;
|
|
|
|
in
|
|
|
|
{
|
2024-11-27 12:51:38 +01:00
|
|
|
test-relativePath = with lib;
|
|
|
|
let
|
|
|
|
testData = [
|
|
|
|
{ from = "bar"; to = "baz"; expected = "./baz"; }
|
|
|
|
{ from = "foo/bar"; to = "foo/baz"; expected = "./baz"; }
|
|
|
|
{ from = "foo"; to = "bar/baz"; expected = "./bar/baz"; }
|
|
|
|
{ from = "foo/bar"; to = "baz"; expected = "./../baz"; }
|
|
|
|
{ from = "foo/bar/baz"; to = "foo"; expected = "./../../foo"; }
|
|
|
|
];
|
|
|
|
in
|
|
|
|
{
|
|
|
|
expr = map (case: relativePath case.from case.to) testData;
|
|
|
|
expected = map (case: case.expected) testData;
|
|
|
|
};
|
2024-11-27 11:21:59 +01:00
|
|
|
}
|