tests.buildenv: test passthru.paths injection
buildEnv stashes `paths` into `passthru.paths` (rather than passing it directly as a derivation attribute) to prevent unexpected string context pollution. Verify that: - paths are accessible via passthru.paths - passthru.paths can be overridden with overrideAttrs
This commit is contained in:
+30
-1
@@ -38,7 +38,36 @@ let
|
||||
testMissingNameThrows = testingThrow (buildEnv { paths = [ ]; }).drvPath;
|
||||
};
|
||||
|
||||
tests = tests-name;
|
||||
tests-passthru-paths = {
|
||||
testPathsInPassthru = {
|
||||
expr =
|
||||
let
|
||||
env = buildEnv {
|
||||
name = "test-env";
|
||||
paths = [ pkgs.hello ];
|
||||
};
|
||||
in
|
||||
builtins.length env.paths > 0;
|
||||
expected = true;
|
||||
};
|
||||
|
||||
testPassthruPathsOverridable = {
|
||||
expr =
|
||||
let
|
||||
env = buildEnv {
|
||||
name = "test-env";
|
||||
paths = [ pkgs.hello ];
|
||||
};
|
||||
overridden = env.overrideAttrs {
|
||||
passthru.paths = [ pkgs.figlet ];
|
||||
};
|
||||
in
|
||||
builtins.length overridden.paths == 1;
|
||||
expected = true;
|
||||
};
|
||||
};
|
||||
|
||||
tests = tests-name // tests-passthru-paths;
|
||||
in
|
||||
|
||||
stdenvNoCC.mkDerivation (finalAttrs: {
|
||||
|
||||
Reference in New Issue
Block a user