dream2nix/tests/nix-unit/test_paths/default.nix

86 lines
1.8 KiB
Nix

{
pkgs ? import <nixpkgs> {},
lib ? import <nixpkgs/lib>,
inputs ? {},
dream2nix ? import ../../.. inputs,
}: let
eval = module:
(lib.evalModules {
modules = [
dream2nix.modules.dream2nix.core
module
];
specialArgs = {
inherit dream2nix;
packageSets.nixpkgs = pkgs;
};
})
.config;
in {
test_package_in_root_1 = let
config = eval {
paths.projectRoot = "${./.}";
paths.package = "${./.}";
};
in {
expr = {inherit (config.paths) projectRoot package;};
expected = {
projectRoot = "${./.}";
package = ".";
};
};
test_package_in_root_2 = let
config = eval {
paths.projectRoot = "${./.}";
paths.package = "./.";
};
in {
expr = {inherit (config.paths) projectRoot package;};
expected = {
projectRoot = "${./.}";
package = "./.";
};
};
test_package_in_subdir_1 = let
config = eval {
paths.projectRoot = "${./.}";
paths.package = "${./.}/package";
};
in {
expr = {inherit (config.paths) projectRoot package;};
expected = {
projectRoot = "${./.}";
package = "./package";
};
};
test_package_in_subdir_2 = let
config = eval {
paths.projectRoot = "${./.}";
paths.package = "./package";
};
in {
expr = {inherit (config.paths) projectRoot package;};
expected = {
projectRoot = "${./.}";
package = "./package";
};
};
test_package_in_subdir_3 = let
self = /nix/store/some/path;
config = eval {
paths.projectRoot = self;
paths.package = self + /package;
};
in {
expr = {inherit (config.paths) projectRoot package;};
expected = {
projectRoot = self;
package = "./package";
};
};
}