aboutsummaryrefslogtreecommitdiff
path: root/tests/flake-searching.sh
diff options
context:
space:
mode:
authorAlexander Bantyev <balsoft@balsoft.ru>2022-01-14 18:03:47 +0300
committerAlexander Bantyev <balsoft@balsoft.ru>2022-01-14 18:03:47 +0300
commitb9f5dccdbeb14a229fd14a3211490d83e53f70b8 (patch)
tree0b69fbe6983e069581e2d19e52f83bd2b069b02a /tests/flake-searching.sh
parentf055cc5a0bfc0871d36cc141e14777acd0e214ca (diff)
Check that we don't search past a git repo
Diffstat (limited to 'tests/flake-searching.sh')
-rw-r--r--tests/flake-searching.sh15
1 files changed, 13 insertions, 2 deletions
diff --git a/tests/flake-searching.sh b/tests/flake-searching.sh
index 7c2041ce1..6558aff9a 100644
--- a/tests/flake-searching.sh
+++ b/tests/flake-searching.sh
@@ -18,11 +18,14 @@ EOF
mkdir subdir
pushd subdir
-for i in "" . .# .#test ../subdir ../subdir#test "$PWD"; do
+success=("" . .# .#test ../subdir ../subdir#test "$PWD")
+failure=("path:$PWD")
+
+for i in "${success[@]}"; do
nix build $i || fail "flake should be found by searching up directories"
done
-for i in "path:$PWD"; do
+for i in "${failure[@]}"; do
! nix build $i || fail "flake should not search up directories when using 'path:'"
done
@@ -32,3 +35,11 @@ nix build --override-input foo . || fail "flake should search up directories whe
sed "s,$PWD/foo,$PWD/foo/subdir,g" -i flake.nix
! nix build || fail "flake should not search upwards when part of inputs"
+
+pushd subdir
+git init
+for i in "${success[@]}" "${failure[@]}"; do
+ ! nix build $i || fail "flake should not search past a git repository"
+done
+rm -rf .git
+popd