Skip to content

Commit e0ae1e6

Browse files
committed
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 <[email protected]>
1 parent 9932977 commit e0ae1e6

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

t/t7005-editor.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ test_expect_success 'determine default editor' '
1313
1414
'
1515

16-
if ! expr "$vi" : '^[a-z]*$' >/dev/null
16+
if ! expr "$vi" : '[a-z]*$' >/dev/null
1717
then
1818
vi=
1919
fi

t/t7006-pager.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ test_expect_success TTY 'no pager with --no-pager' '
109109
# for the first color; the text "commit" comes later.
110110
colorful() {
111111
read firstline <$1
112-
! expr "$firstline" : "^[a-zA-Z]" >/dev/null
112+
! expr "$firstline" : "[a-zA-Z]" >/dev/null
113113
}
114114

115115
test_expect_success 'tests can detect color' '
@@ -167,7 +167,7 @@ test_expect_success 'determine default pager' '
167167
test -n "$less"
168168
'
169169

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
171171
then
172172
test_set_prereq SIMPLEPAGER
173173
fi

0 commit comments

Comments
 (0)