-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(functional/flakes): add dubious-query
- Loading branch information
1 parent
a798569
commit b04005a
Showing
3 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/env bash | ||
|
||
source ./common.sh | ||
|
||
requireGit | ||
clearStoreIfPossible | ||
|
||
nixpkgsDir="$TEST_ROOT/nixpkgs" | ||
createGitRepo "$nixpkgsDir" | ||
createSimpleGitFlake "$nixpkgsDir" | ||
nix registry add --registry "$registry" nixpkgs "git+file://$nixpkgsDir" | ||
|
||
fooDrvPath="$(nix eval --raw "git+file://$nixpkgsDir#foo" --apply '(e: e.drvPath)')" | ||
|
||
# Check that a flakeref without a query is accepted correctly. | ||
assertStderr "nix build --dry-run git+file://$nixpkgsDir#foo" <<EOF | ||
this derivation will be built: | ||
$fooDrvPath | ||
EOF | ||
|
||
# Check that a flakeref with a good query is accepted correctly. | ||
assertStderr "nix build --dry-run git+file://$nixpkgsDir?foo=bar#foo" <<EOF | ||
this derivation will be built: | ||
$fooDrvPath | ||
EOF | ||
|
||
# Check that we get the dubious query warning, when passing in a query without an equal sign. | ||
assertStderr "nix build --dry-run git+file://$nixpkgsDir?bar#foo" <<EOF | ||
warning: dubious URI query 'bar' is missing equal sign '=' | ||
this derivation will be built: | ||
$fooDrvPath | ||
EOF | ||
|
||
# Check that the anchor (#) is taken as a whole, and not split. | ||
assertStderr "nix build --dry-run git+file://$nixpkgsDir#foo?bar" <<EOF | ||
error: flake 'git+file://$nixpkgsDir' does not provide attribute 'packages.$system.foo?bar', 'legacyPackages.$system.foo?bar' or 'foo?bar' | ||
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters