summaryrefslogtreecommitdiff
path: root/t/t3070-wildmatch.sh
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2018-01-30 21:21:18 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-01-30 22:04:00 (GMT)
commit5684c2bc69d6b06cca708a859843c9b2468068d8 (patch)
tree5af335a5bdbcae8df09e267c1f4779d17c95d016 /t/t3070-wildmatch.sh
parentf5ebe8f3f1d481fb25fd71a80b0909987fcb2884 (diff)
downloadgit-5684c2bc69d6b06cca708a859843c9b2468068d8.zip
git-5684c2bc69d6b06cca708a859843c9b2468068d8.tar.gz
git-5684c2bc69d6b06cca708a859843c9b2468068d8.tar.bz2
wildmatch test: use a paranoia pattern from nul_match()
Use a pattern from the nul_match() function in t7008-grep-binary.sh to make sure that we don't just fall through to the "else" if there's an unknown parameter. This is something I added in commit 77f6f4406f ("grep: add a test helper function for less verbose -f \0 tests", 2017-05-20) to grep tests, which were modeled on these wildmatch tests, and I'm now porting back to the original wildmatch tests. I am not using the "say '...'; exit 1" pattern from t0000-basic.sh because if I fail I want to run the rest of the tests (unless under -i), and doing this makes sure we do that and don't exit right away without fully reporting our errors. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3070-wildmatch.sh')
-rwxr-xr-xt/t3070-wildmatch.sh15
1 files changed, 12 insertions, 3 deletions
diff --git a/t/t3070-wildmatch.sh b/t/t3070-wildmatch.sh
index 19ea64b..9691d8e 100755
--- a/t/t3070-wildmatch.sh
+++ b/t/t3070-wildmatch.sh
@@ -10,10 +10,13 @@ match() {
test_expect_success "wildmatch: match '$3' '$4'" "
test-wildmatch wildmatch '$3' '$4'
"
- else
+ elif test "$1" = 0
+ then
test_expect_success "wildmatch: no match '$3' '$4'" "
! test-wildmatch wildmatch '$3' '$4'
"
+ else
+ test_expect_success "PANIC: Test framework error. Unknown matches value $1" 'false'
fi
}
@@ -23,10 +26,13 @@ imatch() {
test_expect_success "iwildmatch: match '$2' '$3'" "
test-wildmatch iwildmatch '$2' '$3'
"
- else
+ elif test "$1" = 0
+ then
test_expect_success "iwildmatch: no match '$2' '$3'" "
! test-wildmatch iwildmatch '$2' '$3'
"
+ else
+ test_expect_success "PANIC: Test framework error. Unknown matches value $1" 'false'
fi
}
@@ -36,10 +42,13 @@ pathmatch() {
test_expect_success "pathmatch: match '$2' '$3'" "
test-wildmatch pathmatch '$2' '$3'
"
- else
+ elif test "$1" = 0
+ then
test_expect_success "pathmatch: no match '$2' '$3'" "
! test-wildmatch pathmatch '$2' '$3'
"
+ else
+ test_expect_success "PANIC: Test framework error. Unknown matches value $1" 'false'
fi
}