aboutsummaryrefslogtreecommitdiff
path: root/tests/build.sh
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2023-06-09 13:06:47 +0200
committerGitHub <noreply@github.com>2023-06-09 13:06:47 +0200
commit381a32981bd9d15da2b06f151c38f1a1229a8800 (patch)
tree34bd75c80a91042816d81e4028a5dc8957fd90d9 /tests/build.sh
parent0e18254aa81b9315c13d6ae736cb38666d19f122 (diff)
parent3c78920f7358957dba37a379e9d0b062dd3192e2 (diff)
Merge branch 'master' into angerman/mac-fix-recursive-nix
Diffstat (limited to 'tests/build.sh')
-rw-r--r--tests/build.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/build.sh b/tests/build.sh
index b579fc374..697aff0f9 100644
--- a/tests/build.sh
+++ b/tests/build.sh
@@ -57,6 +57,30 @@ nix build -f multiple-outputs.nix --json 'e^*' --no-link | jq --exit-status '
(.outputs | keys == ["a_a", "b", "c"]))
'
+# test buidling from non-drv attr path
+
+nix build -f multiple-outputs.nix --json 'e.a_a.outPath' --no-link | jq --exit-status '
+ (.[0] |
+ (.drvPath | match(".*multiple-outputs-e.drv")) and
+ (.outputs | keys == ["a_a"]))
+'
+
+# Illegal type of string context
+expectStderr 1 nix build -f multiple-outputs.nix 'e.a_a.drvPath' \
+ | grepQuiet "has a context which refers to a complete source and binary closure."
+
+# No string context
+expectStderr 1 nix build --expr '""' --no-link \
+ | grepQuiet "has 0 entries in its context. It should only have exactly one entry"
+
+# Too much string context
+expectStderr 1 nix build --impure --expr 'with (import ./multiple-outputs.nix).e.a_a; "${drvPath}${outPath}"' --no-link \
+ | grepQuiet "has 2 entries in its context. It should only have exactly one entry"
+
+nix build --impure --json --expr 'builtins.unsafeDiscardOutputDependency (import ./multiple-outputs.nix).e.a_a.drvPath' --no-link | jq --exit-status '
+ (.[0] | .path | match(".*multiple-outputs-e.drv"))
+'
+
# Test building from raw store path to drv not expression.
drv=$(nix eval -f multiple-outputs.nix --raw a.drvPath)