Skip to content

Commit

Permalink
Update dubious-query.sh
Browse files Browse the repository at this point in the history
Co-authored-by: Jörg Thalheim <[email protected]>
  • Loading branch information
bryanhonof and Mic92 committed Sep 27, 2024
1 parent 7141cf7 commit 28d72a7
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tests/functional/flakes/dubious-query.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ source ./common.sh

requireGit

nixpkgsDir="$TEST_ROOT/nixpkgs"
createGitRepo "$nixpkgsDir"
createSimpleGitFlake "$nixpkgsDir"
repoDir="$TEST_ROOT/repo"
createGitRepo "$repoDir"
createSimpleGitFlake "$repoDir"

# Check that a flakeref without a query is accepted correctly.
expectStderr 0 nix --offline build --dry-run "git+file://$nixpkgsDir#foo"
expectStderr 0 nix --offline build --dry-run "git+file://$repoDir#foo"

# Check that a flakeref with a good query is accepted correctly.
expectStderr 0 nix --offline build --dry-run "git+file://$nixpkgsDir?foo=bar#foo"
expectStderr 0 nix --offline build --dry-run "git+file://$repoDir?foo=bar#foo"

# Check that we get the dubious query warning, when passing in a query without an equal sign.
expectStderr 0 nix --offline build --dry-run "git+file://$nixpkgsDir?bar#foo" \
expectStderr 0 nix --offline build --dry-run "git+file://$repoDir?bar#foo" \
| grepQuiet "warning: dubious URI query 'bar' is missing equal sign '=', ignoring"

# Check that the anchor (#) is taken as a whole, not split, and throws an error.
expectStderr 1 nix --offline build --dry-run "git+file://$nixpkgsDir#foo?bar" \
| grepQuiet "error: flake 'git+file://$nixpkgsDir' does not provide attribute 'packages.$system.foo?bar', 'legacyPackages.$system.foo?bar' or 'foo?bar'"
expectStderr 1 nix --offline build --dry-run "git+file://$repoDir#foo?bar" \
| grepQuiet "error: flake 'git+file://$repoDir' does not provide attribute 'packages.$system.foo?bar', 'legacyPackages.$system.foo?bar' or 'foo?bar'"

0 comments on commit 28d72a7

Please sign in to comment.