mirror of
https://github.com/NixOS/nix
synced 2025-07-07 10:11:47 +02:00
Add test for source path display
This commit is contained in:
parent
3f0a8241fc
commit
b2038f120c
2 changed files with 32 additions and 1 deletions
|
@ -29,7 +29,8 @@ suites += {
|
||||||
'non-flake-inputs.sh',
|
'non-flake-inputs.sh',
|
||||||
'relative-paths.sh',
|
'relative-paths.sh',
|
||||||
'symlink-paths.sh',
|
'symlink-paths.sh',
|
||||||
'debugger.sh'
|
'debugger.sh',
|
||||||
|
'source-paths.sh',
|
||||||
],
|
],
|
||||||
'workdir': meson.current_source_dir(),
|
'workdir': meson.current_source_dir(),
|
||||||
}
|
}
|
||||||
|
|
30
tests/functional/flakes/source-paths.sh
Normal file
30
tests/functional/flakes/source-paths.sh
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
source ./common.sh
|
||||||
|
|
||||||
|
requireGit
|
||||||
|
|
||||||
|
repo=$TEST_ROOT/repo
|
||||||
|
|
||||||
|
createGitRepo "$repo"
|
||||||
|
|
||||||
|
cat > "$repo/flake.nix" <<EOF
|
||||||
|
{
|
||||||
|
outputs = { ... }: {
|
||||||
|
x = 1;
|
||||||
|
y = assert false; 1;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
expectStderr 1 nix eval "$repo#x" | grepQuiet "error: path '$repo/flake.nix' does not exist"
|
||||||
|
|
||||||
|
git -C "$repo" add flake.nix
|
||||||
|
|
||||||
|
[[ $(nix eval "$repo#x") = 1 ]]
|
||||||
|
|
||||||
|
expectStderr 1 nix eval "$repo#y" | grepQuiet "at $repo/flake.nix:"
|
||||||
|
|
||||||
|
git -C "$repo" commit -a -m foo
|
||||||
|
|
||||||
|
expectStderr 1 nix eval "git+file://$repo?ref=master#y" | grepQuiet "at «git+file://$repo?ref=master&rev=.*»/flake.nix:"
|
Loading…
Add table
Add a link
Reference in a new issue