mirror of
https://github.com/NixOS/nix
synced 2025-07-07 01:51:47 +02:00
* Refactor a bit so that more tests can be added.
This commit is contained in:
parent
b5363810bb
commit
46e42c92c1
5 changed files with 26 additions and 36 deletions
|
@ -1,23 +1,35 @@
|
|||
with import ./config.nix;
|
||||
|
||||
let
|
||||
rec {
|
||||
|
||||
a = mkDerivation {
|
||||
name = "multiple-outputs-a";
|
||||
outputs = [ "first" "second" ];
|
||||
builder = ./multiple-outputs.a.builder.sh;
|
||||
builder = builtins.toFile "builder.sh"
|
||||
''
|
||||
mkdir $first $second
|
||||
test -z $all
|
||||
echo "second" > $first/file
|
||||
echo "first" > $second/file
|
||||
'';
|
||||
helloString = "Hello, world!";
|
||||
};
|
||||
|
||||
in
|
||||
b = mkDerivation {
|
||||
defaultOutput = assert a.second.helloString == "Hello, world!"; a;
|
||||
firstOutput = a.first.first;
|
||||
secondOutput = a.second.first.first.second.second.first.second;
|
||||
allOutputs = a.all;
|
||||
name = "multiple-outputs-b";
|
||||
builder = builtins.toFile "builder.sh"
|
||||
''
|
||||
mkdir $out
|
||||
test "$firstOutput $secondOutput" = "$allOutputs"
|
||||
test "$defaultOutput" = "$firstOutput"
|
||||
test "$(cat $firstOutput/file)" = "second"
|
||||
test "$(cat $secondOutput/file)" = "first"
|
||||
echo "success" > $out/file
|
||||
'';
|
||||
};
|
||||
|
||||
assert a.second.helloString == "Hello, world!";
|
||||
|
||||
mkDerivation {
|
||||
defaultOutput = a;
|
||||
firstOutput = a.first.first;
|
||||
secondOutput = a.second.first.first.second.second.first.second;
|
||||
allOutputs = a.all;
|
||||
name = "multiple-outputs-b";
|
||||
builder = ./multiple-outputs.b.builder.sh;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue