[PATCH 1/2] t0109: refactor test code into a function

John Keeping john at keeping.me.uk
Sun Apr 14 18:07:41 CEST 2013


This will allow us to run this test for multiple URLs.

While doing this, also specify CGIT_CONFIG and QUERY_STRING when
invoking cgit under strace.

Signed-off-by: John Keeping <john at keeping.me.uk>
---
 tests/t0109-gitconfig.sh | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/tests/t0109-gitconfig.sh b/tests/t0109-gitconfig.sh
index f64e691..31d18b5 100755
--- a/tests/t0109-gitconfig.sh
+++ b/tests/t0109-gitconfig.sh
@@ -9,17 +9,22 @@ test -n "$(which strace 2>/dev/null)" || {
 	exit
 }
 
-test_expect_success 'no access to $HOME' '
+test_no_home_access () {
 	non_existant_path="/path/to/some/place/that/does/not/possibly/exist"
 	while test -d "$non_existant_path"; do
 		non_existant_path="$non_existant_path/$(date +%N)"
-	done
+	done &&
+	CGIT_CONFIG="$(pwd)/cgitrc" QUERY_STRING="url=$1" \
 	strace \
 		-E HOME="$non_existant_path" \
 		-E CGIT_CONFIG="$PWD/cgitrc" \
 		-E QUERY_STRING="url=foo/commit" \
 		-e access -f -o strace.out cgit &&
 	test_must_fail grep "$non_existant_path" strace.out
+}
+
+test_expect_success 'no access to $HOME' '
+	test_no_home_access ""
 '
 
 test_done
-- 
1.8.2.694.ga76e9c3.dirty





More information about the CGit mailing list