From 392e07d28a23aec9942b9ed0d122e35d2d268fb9 Mon Sep 17 00:00:00 2001 From: John Keeping Date: Mon, 4 Mar 2013 21:58:49 +0000 Subject: tests: "grep -e" is not portable to all platforms The "-e" option to grep is not needed unless specifying more than one pattern, which we don't do. Remove it to avoid restricting the tests on platforms that do not have a grep that recognises "-e". Signed-off-by: John Keeping --- tests/t0101-index.sh | 18 +++++++++--------- tests/t0102-summary.sh | 22 +++++++++++----------- tests/t0103-log.sh | 20 ++++++++++---------- tests/t0104-tree.sh | 12 ++++++------ tests/t0105-commit.sh | 12 ++++++------ tests/t0106-diff.sh | 10 +++++----- tests/t0107-snapshot.sh | 6 +++--- tests/t0108-patch.sh | 10 +++++----- 8 files changed, 55 insertions(+), 55 deletions(-) diff --git a/tests/t0101-index.sh b/tests/t0101-index.sh index 573a351..ab63aca 100755 --- a/tests/t0101-index.sh +++ b/tests/t0101-index.sh @@ -5,14 +5,14 @@ prepare_tests "Check content on index page" run_test 'generate index page' 'cgit_url "" >trash/tmp' -run_test 'find foo repo' 'grep -e "foo" trash/tmp' -run_test 'find foo description' 'grep -e "\[no description\]" trash/tmp' -run_test 'find bar repo' 'grep -e "bar" trash/tmp' -run_test 'find bar description' 'grep -e "the bar repo" trash/tmp' -run_test 'find foo+bar repo' 'grep -e ">foo+bar<" trash/tmp' -run_test 'verify foo+bar link' 'grep -e "/foo+bar/" trash/tmp' -run_test 'verify "with%20space" link' 'grep -e "/with%20space/" trash/tmp' -run_test 'no tree-link' '! grep -e "foo/tree" trash/tmp' -run_test 'no log-link' '! grep -e "foo/log" trash/tmp' +run_test 'find foo repo' 'grep "foo" trash/tmp' +run_test 'find foo description' 'grep "\[no description\]" trash/tmp' +run_test 'find bar repo' 'grep "bar" trash/tmp' +run_test 'find bar description' 'grep "the bar repo" trash/tmp' +run_test 'find foo+bar repo' 'grep ">foo+bar<" trash/tmp' +run_test 'verify foo+bar link' 'grep "/foo+bar/" trash/tmp' +run_test 'verify "with%20space" link' 'grep "/with%20space/" trash/tmp' +run_test 'no tree-link' '! grep "foo/tree" trash/tmp' +run_test 'no log-link' '! grep "foo/log" trash/tmp' tests_done diff --git a/tests/t0102-summary.sh b/tests/t0102-summary.sh index f299c5a..f778cb4 100755 --- a/tests/t0102-summary.sh +++ b/tests/t0102-summary.sh @@ -5,22 +5,22 @@ prepare_tests "Check content on summary page" run_test 'generate foo summary' 'cgit_url "foo" >trash/tmp' -run_test 'find commit 1' 'grep -e "commit 1" trash/tmp' -run_test 'find commit 5' 'grep -e "commit 5" trash/tmp' -run_test 'find branch master' 'grep -e "master" trash/tmp' -run_test 'no tags' '! grep -e "tags" trash/tmp' +run_test 'find commit 1' 'grep "commit 1" trash/tmp' +run_test 'find commit 5' 'grep "commit 5" trash/tmp' +run_test 'find branch master' 'grep "master" trash/tmp' +run_test 'no tags' '! grep "tags" trash/tmp' run_test 'clone-url expanded correctly' ' - grep -e "git://example.org/foo.git" trash/tmp + grep "git://example.org/foo.git" trash/tmp ' run_test 'generate bar summary' 'cgit_url "bar" >trash/tmp' -run_test 'no commit 45' '! grep -e "commit 45" trash/tmp' -run_test 'find commit 46' 'grep -e "commit 46" trash/tmp' -run_test 'find commit 50' 'grep -e "commit 50" trash/tmp' -run_test 'find branch master' 'grep -e "master" trash/tmp' -run_test 'no tags' '! grep -e "tags" trash/tmp' +run_test 'no commit 45' '! grep "commit 45" trash/tmp' +run_test 'find commit 46' 'grep "commit 46" trash/tmp' +run_test 'find commit 50' 'grep "commit 50" trash/tmp' +run_test 'find branch master' 'grep "master" trash/tmp' +run_test 'no tags' '! grep "tags" trash/tmp' run_test 'clone-url expanded correctly' ' - grep -e "git://example.org/bar.git" trash/tmp + grep "git://example.org/bar.git" trash/tmp ' tests_done diff --git a/tests/t0103-log.sh b/tests/t0103-log.sh index 7fa6754..67fcba0 100755 --- a/tests/t0103-log.sh +++ b/tests/t0103-log.sh @@ -5,21 +5,21 @@ prepare_tests "Check content on log page" run_test 'generate foo/log' 'cgit_url "foo/log" >trash/tmp' -run_test 'find commit 1' 'grep -e "commit 1" trash/tmp' -run_test 'find commit 5' 'grep -e "commit 5" trash/tmp' +run_test 'find commit 1' 'grep "commit 1" trash/tmp' +run_test 'find commit 5' 'grep "commit 5" trash/tmp' run_test 'generate bar/log' 'cgit_url "bar/log" >trash/tmp' -run_test 'find commit 1' 'grep -e "commit 1" trash/tmp' -run_test 'find commit 50' 'grep -e "commit 50" trash/tmp' +run_test 'find commit 1' 'grep "commit 1" trash/tmp' +run_test 'find commit 50' 'grep "commit 50" trash/tmp' run_test 'generate "with%20space/log?qt=grep&q=commit+1"' ' cgit_url "with+space/log&qt=grep&q=commit+1" >trash/tmp ' -run_test 'find commit 1' 'grep -e "commit 1" trash/tmp' -run_test 'find link with %20 in path' 'grep -e "/with%20space/log/?qt=grep" trash/tmp' -run_test 'find link with + in arg' 'grep -e "/log/?qt=grep&q=commit+1" trash/tmp' -run_test 'no links with space in path' '! grep -e "href=./with space/" trash/tmp' -run_test 'no links with space in arg' '! grep -e "q=commit 1" trash/tmp' -run_test 'commit 2 is not visible' '! grep -e "commit 2" trash/tmp' +run_test 'find commit 1' 'grep "commit 1" trash/tmp' +run_test 'find link with %20 in path' 'grep "/with%20space/log/?qt=grep" trash/tmp' +run_test 'find link with + in arg' 'grep "/log/?qt=grep&q=commit+1" trash/tmp' +run_test 'no links with space in path' '! grep "href=./with space/" trash/tmp' +run_test 'no links with space in arg' '! grep "q=commit 1" trash/tmp' +run_test 'commit 2 is not visible' '! grep "commit 2" trash/tmp' tests_done diff --git a/tests/t0104-tree.sh b/tests/t0104-tree.sh index 2ce1251..7aa3b8d 100755 --- a/tests/t0104-tree.sh +++ b/tests/t0104-tree.sh @@ -5,29 +5,29 @@ prepare_tests "Check content on tree page" run_test 'generate bar/tree' 'cgit_url "bar/tree" >trash/tmp' -run_test 'find file-1' 'grep -e "file-1" trash/tmp' -run_test 'find file-50' 'grep -e "file-50" trash/tmp' +run_test 'find file-1' 'grep "file-1" trash/tmp' +run_test 'find file-50' 'grep "file-50" trash/tmp' run_test 'generate bar/tree/file-50' 'cgit_url "bar/tree/file-50" >trash/tmp' run_test 'find line 1' ' - grep -e "1" trash/tmp + grep "1" trash/tmp ' run_test 'no line 2' ' - ! grep -e "2" trash/tmp + ! grep "2" trash/tmp ' run_test 'generate foo+bar/tree' 'cgit_url "foo%2bbar/tree" >trash/tmp' run_test 'verify a+b link' ' - grep -e "/foo+bar/tree/a+b" trash/tmp + grep "/foo+bar/tree/a+b" trash/tmp ' run_test 'generate foo+bar/tree?h=1+2' 'cgit_url "foo%2bbar/tree&h=1%2b2" >trash/tmp' run_test 'verify a+b?h=1+2 link' ' - grep -e "/foo+bar/tree/a+b?h=1%2b2" trash/tmp + grep "/foo+bar/tree/a+b?h=1%2b2" trash/tmp ' tests_done diff --git a/tests/t0105-commit.sh b/tests/t0105-commit.sh index ae794c8..19a650b 100755 --- a/tests/t0105-commit.sh +++ b/tests/t0105-commit.sh @@ -5,18 +5,18 @@ prepare_tests "Check content on commit page" run_test 'generate foo/commit' 'cgit_url "foo/commit" >trash/tmp' -run_test 'find tree link' 'grep -e "" trash/tmp' +run_test 'find tree link' 'grep "" trash/tmp' run_test 'find parent link' 'grep -E "" trash/tmp' run_test 'find commit subject' ' - grep -e "
commit 5<" trash/tmp + grep "
commit 5<" trash/tmp ' -run_test 'find commit msg' 'grep -e "
" trash/tmp' -run_test 'find diffstat' 'grep -e "" trash/tmp' +run_test 'find commit msg' 'grep "
" trash/tmp' +run_test 'find diffstat' 'grep "
" trash/tmp' run_test 'find diff summary' ' - grep -e "1 files changed, 1 insertions, 0 deletions" trash/tmp + grep "1 files changed, 1 insertions, 0 deletions" trash/tmp ' run_test 'get root commit' ' @@ -31,7 +31,7 @@ run_test 'root commit contains diffstat' ' run_test 'root commit contains diff' ' grep ">diff --git a/file-1 b/file-1<" trash/tmp && - grep -e "
+1
" trash/tmp + grep "
+1
" trash/tmp ' tests_done diff --git a/tests/t0106-diff.sh b/tests/t0106-diff.sh index e140bcc..eee0c8c 100755 --- a/tests/t0106-diff.sh +++ b/tests/t0106-diff.sh @@ -5,16 +5,16 @@ prepare_tests "Check content on diff page" run_test 'generate foo/diff' 'cgit_url "foo/diff" >trash/tmp' -run_test 'find diff header' 'grep -e "a/file-5 b/file-5" trash/tmp' -run_test 'find blob link' 'grep -e "@@ -0,0 +1 @@" trash/tmp + grep "
@@ -0,0 +1 @@
" trash/tmp ' run_test 'find added line' ' - grep -e "
+5
" trash/tmp + grep "
+5
" trash/tmp ' tests_done diff --git a/tests/t0107-snapshot.sh b/tests/t0107-snapshot.sh index 8ab4912..8ad9573 100755 --- a/tests/t0107-snapshot.sh +++ b/tests/t0107-snapshot.sh @@ -10,10 +10,10 @@ run_test 'get foo/snapshot/master.tar.gz' ' run_test 'check html headers' ' head -n 1 trash/tmp | - grep -e "Content-Type: application/x-gzip" && + grep "Content-Type: application/x-gzip" && head -n 2 trash/tmp | - grep -e "Content-Disposition: inline; filename=.master.tar.gz." + grep "Content-Disposition: inline; filename=.master.tar.gz." ' run_test 'strip off the header lines' ' @@ -32,7 +32,7 @@ run_test 'count files' ' ' run_test 'verify untarred file-5' ' - grep -e "^5$" trash/master/file-5 && + grep "^5$" trash/master/file-5 && test $(cat trash/master/file-5 | wc -l) = 1 ' diff --git a/tests/t0108-patch.sh b/tests/t0108-patch.sh index 6ee70b3..f15c893 100755 --- a/tests/t0108-patch.sh +++ b/tests/t0108-patch.sh @@ -9,19 +9,19 @@ run_test 'generate foo/patch' ' ' run_test 'find `From:` line' ' - grep -e "^From: " trash/tmp + grep "^From: " trash/tmp ' run_test 'find `Date:` line' ' - grep -e "^Date: " trash/tmp + grep "^Date: " trash/tmp ' run_test 'find `Subject:` line' ' - grep -e "^Subject: commit 5" trash/tmp + grep "^Subject: commit 5" trash/tmp ' run_test 'find `cgit` signature' ' - tail -1 trash/tmp | grep -e "^cgit" + tail -1 trash/tmp | grep "^cgit" ' run_test 'find initial commit' ' @@ -33,7 +33,7 @@ run_test 'generate patch for initial commit' ' ' run_test 'find `cgit` signature' ' - tail -1 trash/tmp | grep -e "^cgit" + tail -1 trash/tmp | grep "^cgit" ' tests_done -- cgit 1.4.1