diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2023-01-18 14:21:17 +0100 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2023-01-18 14:21:17 +0100 |
commit | 1ebfa6ba2d5e6be9eb0d83a89dc4fcb2470e773a (patch) | |
tree | b6ea676ac0a135ba96173f996c449b054ec6f512 /tests | |
parent | 95cfd50d25bf8f5f969bc1fbdc5fd0b967db670b (diff) |
Add some tests for illegal output names
Diffstat (limited to 'tests')
-rw-r--r-- | tests/build.sh | 4 | ||||
-rw-r--r-- | tests/multiple-outputs.nix | 10 | ||||
-rw-r--r-- | tests/multiple-outputs.sh | 3 |
3 files changed, 15 insertions, 2 deletions
diff --git a/tests/build.sh b/tests/build.sh index 898c6963a..b6dadb433 100644 --- a/tests/build.sh +++ b/tests/build.sh @@ -89,7 +89,7 @@ nix build "$drv^first,second" --no-link --json | jq --exit-status ' (.outputs | (keys | length == 2) and (.first | match(".*multiple-outputs-a-first")) and - (.second | match(".*multiple-outputs-a-second")))) + (.second | match(".*multiple-outputs-a-second")))) ' nix build "$drv^*" --no-link --json | jq --exit-status ' @@ -98,7 +98,7 @@ nix build "$drv^*" --no-link --json | jq --exit-status ' (.outputs | (keys | length == 2) and (.first | match(".*multiple-outputs-a-first")) and - (.second | match(".*multiple-outputs-a-second")))) + (.second | match(".*multiple-outputs-a-second")))) ' # Make sure that `--impure` works (regression test for https://github.com/NixOS/nix/issues/6488) diff --git a/tests/multiple-outputs.nix b/tests/multiple-outputs.nix index 9a097b5f1..413d392e4 100644 --- a/tests/multiple-outputs.nix +++ b/tests/multiple-outputs.nix @@ -117,4 +117,14 @@ rec { ''; }; + invalid-output-name-1 = mkDerivation { + name = "invalid-output-name-1"; + outputs = [ "out/"]; + }; + + invalid-output-name-2 = mkDerivation { + name = "invalid-output-name-2"; + outputs = [ "x" "foo$"]; + }; + } diff --git a/tests/multiple-outputs.sh b/tests/multiple-outputs.sh index 0d45ad35b..66be6fa64 100644 --- a/tests/multiple-outputs.sh +++ b/tests/multiple-outputs.sh @@ -83,3 +83,6 @@ nix-store --gc --keep-derivations --keep-outputs nix-store --gc --print-roots rm -rf $NIX_STORE_DIR/.links rmdir $NIX_STORE_DIR + +nix build -f multiple-outputs.nix invalid-output-name-1 2>&1 | grep 'contains illegal character' +nix build -f multiple-outputs.nix invalid-output-name-2 2>&1 | grep 'contains illegal character' |