@matheusbsbs / matheus-bagliano / commits / e0ae1e6f4d
Fork 0

tests: remove unnecessary '^' from 'expr' regular expression

As Brandon noticed, a regular expression match given to 'expr' is already anchored at the beginning. Some versions of expr even complain about this. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Jun 21, 2010 at 11:18 UTC e0ae1e6f4d53c68bd219385f6f309c033d0fc673
2 files changed +3 -3
t/t7005-editor.sh
+1 -1
@@ -13,7 +13,7 @@ test_expect_success 'determine default editor' '
13
14 '
15
16 -if ! expr "$vi" : '^[a-z]*$' >/dev/null
16 +if ! expr "$vi" : '[a-z]*$' >/dev/null
17 then
18 vi=
19 fi
t/t7006-pager.sh
+2 -2
@@ -109,7 +109,7 @@ test_expect_success TTY 'no pager with --no-pager' '
109 # for the first color; the text "commit" comes later.
110 colorful() {
111 read firstline <$1
112 - ! expr "$firstline" : "^[a-zA-Z]" >/dev/null
112 + ! expr "$firstline" : "[a-zA-Z]" >/dev/null
113 }
114
115 test_expect_success 'tests can detect color' '
@@ -167,7 +167,7 @@ test_expect_success 'determine default pager' '
167 test -n "$less"
168 '
169
170 -if expr "$less" : '^[a-z][a-z]*$' >/dev/null && test_have_prereq TTY
170 +if expr "$less" : '[a-z][a-z]*$' >/dev/null && test_have_prereq TTY
171 then
172 test_set_prereq SIMPLEPAGER
173 fi