This repository has been archived on 2025-04-14. You can view files and clone it, but cannot push or open issues or pull requests.
website-old/tests.nix
Kiara Grouwstra 54bf9da2a3
init
2025-04-14 11:20:58 +02:00

42 lines
859 B
Nix

# tests written for running with `nix-unit`
# https://github.com/nix-community/nix-unit
let
inherit (import ./. { }) lib;
in
{
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;
};
}