Skip to content

Commit

Permalink
tests: remove unnecessary '^' from 'expr' regular expression
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed Jun 21, 2010
1 parent 9932977 commit e0ae1e6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion t/t7005-editor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ test_expect_success 'determine default editor' '
'

if ! expr "$vi" : '^[a-z]*$' >/dev/null
if ! expr "$vi" : '[a-z]*$' >/dev/null
then
vi=
fi
Expand Down
4 changes: 2 additions & 2 deletions t/t7006-pager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ test_expect_success TTY 'no pager with --no-pager' '
# for the first color; the text "commit" comes later.
colorful() {
read firstline <$1
! expr "$firstline" : "^[a-zA-Z]" >/dev/null
! expr "$firstline" : "[a-zA-Z]" >/dev/null
}

test_expect_success 'tests can detect color' '
Expand Down Expand Up @@ -167,7 +167,7 @@ test_expect_success 'determine default pager' '
test -n "$less"
'

if expr "$less" : '^[a-z][a-z]*$' >/dev/null && test_have_prereq TTY
if expr "$less" : '[a-z][a-z]*$' >/dev/null && test_have_prereq TTY
then
test_set_prereq SIMPLEPAGER
fi
Expand Down

0 comments on commit e0ae1e6

Please sign in to comment.