Add tests for getContext and appendContext
This commit is contained in:
parent
4b8dff9aa8
commit
048638f6a1
27
tests/eval-compare/builtins.appendContext.nix
Normal file
27
tests/eval-compare/builtins.appendContext.nix
Normal file
|
@ -0,0 +1,27 @@
|
|||
let
|
||||
drv = derivation {
|
||||
name = "fail";
|
||||
builder = "/bin/false";
|
||||
system = "x86_64-linux";
|
||||
outputs = [ "out" "foo" ];
|
||||
};
|
||||
|
||||
path = "${./eval-okay-context-introspection.nix}";
|
||||
|
||||
desired-context = {
|
||||
"${builtins.unsafeDiscardStringContext path}" = {
|
||||
path = true;
|
||||
};
|
||||
"${builtins.unsafeDiscardStringContext drv.drvPath}" = {
|
||||
outputs = [ "foo" "out" ];
|
||||
allOutputs = true;
|
||||
};
|
||||
};
|
||||
|
||||
legit-context = builtins.getContext "${path}${drv.outPath}${drv.foo.outPath}${drv.drvPath}";
|
||||
|
||||
constructed-context = builtins.getContext (builtins.appendContext "" desired-context);
|
||||
in [ (builtins.appendContext "foo" {})
|
||||
(legit-context == constructed-context)
|
||||
constructed-context
|
||||
]
|
5
tests/eval-compare/builtins.getContext.nix
Normal file
5
tests/eval-compare/builtins.getContext.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
with builtins;
|
||||
|
||||
[ (getContext "foo")
|
||||
(getContext (toFile "foo" "foo contents"))
|
||||
]
|
Loading…
Reference in a new issue