1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-06 21:41:48 +02:00

Add test for source path display

This commit is contained in:
Eelco Dolstra 2025-04-01 13:58:56 +02:00
parent 3f0a8241fc
commit b2038f120c
2 changed files with 32 additions and 1 deletions

View file

@ -29,7 +29,8 @@ suites += {
'non-flake-inputs.sh',
'relative-paths.sh',
'symlink-paths.sh',
'debugger.sh'
'debugger.sh',
'source-paths.sh',
],
'workdir': meson.current_source_dir(),
}

View 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:"