mirror of
https://git.zx2c4.com/cgit
synced 2024-11-09 10:08:42 +00:00
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 <john@keeping.me.uk>
This commit is contained in:
parent
78a24e5c55
commit
392e07d28a
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 "<a class=.no. id=.n1. name=.n1. href=.#n1.>1</a>" trash/tmp
|
||||
grep "<a class=.no. id=.n1. name=.n1. href=.#n1.>1</a>" trash/tmp
|
||||
'
|
||||
|
||||
run_test 'no line 2' '
|
||||
! grep -e "<a class=.no. id=.n2. name=.n2. href=.#n2.>2</a>" trash/tmp
|
||||
! grep "<a class=.no. id=.n2. name=.n2. href=.#n2.>2</a>" 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
|
||||
|
@ -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 "<a href=./foo/tree/.>" trash/tmp'
|
||||
run_test 'find tree link' 'grep "<a href=./foo/tree/.>" trash/tmp'
|
||||
run_test 'find parent link' 'grep -E "<a href=./foo/commit/\?id=.+>" trash/tmp'
|
||||
|
||||
run_test 'find commit subject' '
|
||||
grep -e "<div class=.commit-subject.>commit 5<" trash/tmp
|
||||
grep "<div class=.commit-subject.>commit 5<" trash/tmp
|
||||
'
|
||||
|
||||
run_test 'find commit msg' 'grep -e "<div class=.commit-msg.></div>" trash/tmp'
|
||||
run_test 'find diffstat' 'grep -e "<table summary=.diffstat. class=.diffstat.>" trash/tmp'
|
||||
run_test 'find commit msg' 'grep "<div class=.commit-msg.></div>" trash/tmp'
|
||||
run_test 'find diffstat' 'grep "<table summary=.diffstat. class=.diffstat.>" 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 "<div class=.add.>+1</div>" trash/tmp
|
||||
grep "<div class=.add.>+1</div>" trash/tmp
|
||||
'
|
||||
|
||||
tests_done
|
||||
|
@ -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 "<a href=./foo/tree/file-5?id=" trash/tmp'
|
||||
run_test 'find added file' 'grep -e "new file mode 100644" trash/tmp'
|
||||
run_test 'find diff header' 'grep "a/file-5 b/file-5" trash/tmp'
|
||||
run_test 'find blob link' 'grep "<a href=./foo/tree/file-5?id=" trash/tmp'
|
||||
run_test 'find added file' 'grep "new file mode 100644" trash/tmp'
|
||||
|
||||
run_test 'find hunk header' '
|
||||
grep -e "<div class=.hunk.>@@ -0,0 +1 @@</div>" trash/tmp
|
||||
grep "<div class=.hunk.>@@ -0,0 +1 @@</div>" trash/tmp
|
||||
'
|
||||
|
||||
run_test 'find added line' '
|
||||
grep -e "<div class=.add.>+5</div>" trash/tmp
|
||||
grep "<div class=.add.>+5</div>" trash/tmp
|
||||
'
|
||||
|
||||
tests_done
|
||||
|
@ -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
|
||||
'
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user