diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Test the features the suite never reached
Index sorting, the commit graph, the stats periods past a week, the hex
dump of a binary file and a Lua filter's html_url_arg and html_include
ran in no test.
| -rwxr-xr-x | tests/t0101-index.sh | 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -rwxr-xr-x | tests/t0103-log.sh | 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -rwxr-xr-x | tests/t0104-tree.sh | 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -rwxr-xr-x | tests/t0112-stats.sh | 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -rwxr-xr-x | tests/t0201-filters.sh | 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
5 files changed, 75 insertions, 0 deletions
diff --git a/tests/t0101-index.sh b/tests/t0101-index.sh index e433beb..8d389b6 100755 --- a/tests/t0101-index.sh +++ b/tests/t0101-index.sh @@ -67,4 +67,17 @@ test_expect_success 'a cut description keeps whole characters' ' grep ">日本語\.\.\.</a>" tmp ' +# The index sorts by a column only when asked, which nothing else exercises. +test_expect_success 'the index sorts by a column on request' ' + cgit_query "s=name" >tmp && + bar=$(grep -n ">bar</a>" tmp | head -1 | cut -d: -f1) && + foo=$(grep -n ">foo</a>" tmp | head -1 | cut -d: -f1) && + test "$bar" -lt "$foo" && + for s in desc owner idle + do + cgit_query "s=$s" >tmp && + grep ">foo</a>" tmp || return 1 + done +' + test_done diff --git a/tests/t0103-log.sh b/tests/t0103-log.sh index f9612e6..9671e7f 100755 --- a/tests/t0103-log.sh +++ b/tests/t0103-log.sh @@ -101,4 +101,13 @@ test_expect_success 'a cut subject keeps whole characters' ' grep ">日本語の説\.\.\.</a>" tmp ' +test_expect_success 'the log draws the commit graph when enabled' ' + { + echo "enable-commit-graph=1" && + sed "s/^cache-size=.*/cache-size=0/" cgitrc + } >graphrc && + CGIT_CONFIG="$PWD/graphrc" QUERY_STRING="url=foo/log/" cgit >tmp && + grep "class=.commitgraph." tmp +' + test_done diff --git a/tests/t0104-tree.sh b/tests/t0104-tree.sh index e92b2a2..b48c394 100755 --- a/tests/t0104-tree.sh +++ b/tests/t0104-tree.sh @@ -135,4 +135,23 @@ test_expect_success 'a long directory chain ends on a link' ' ! grep " / </td>" tmp ' +test_expect_success 'a binary file in the tree shows as a hex dump' ' + test_create_repo repos/bin && + ( + cd repos/bin && + printf "\\000\\001\\002bin" >blob.bin && + git add blob.bin && + git commit -m binary + ) && + { + echo "virtual-root=/" && + echo "cache-size=0" && + echo "repo.url=bin" && + echo "repo.path=$PWD/repos/bin/.git" + } >binrc && + CGIT_CONFIG="$PWD/binrc" QUERY_STRING="url=bin/tree/blob.bin" cgit >tmp && + grep "<table class=.bin-blob.>" tmp && + grep "<td class=.right.>0000</td><td class=.hex.> 00 01 02 62 69 6e" tmp +' + test_done diff --git a/tests/t0112-stats.sh b/tests/t0112-stats.sh index 4d61e6c..7b08a6b 100755 --- a/tests/t0112-stats.sh +++ b/tests/t0112-stats.sh @@ -85,4 +85,15 @@ test_expect_success 'max-stats bounds the selectable periods' ' ! grep "<option value=.q." tmp ' +# Each period buckets commits and labels its columns its own way, so every one +# gets a page of its own here. +test_expect_success 'every period renders its own columns' ' + statq "url=stat/stats/&period=m" >tmp && + grep -E "<th[^>]*>[A-Z][a-z][a-z] [0-9]{4}</th>" tmp && + statq "url=stat/stats/&period=q" >tmp && + grep -E "<th[^>]*>Q[1-4] [0-9]{4}</th>" tmp && + statq "url=stat/stats/&period=y" >tmp && + grep -E "<th[^>]*>[0-9]{4}</th>" tmp +' + test_done diff --git a/tests/t0201-filters.sh b/tests/t0201-filters.sh index 3987bdc..6d33803 100755 --- a/tests/t0201-filters.sh +++ b/tests/t0201-filters.sh @@ -171,4 +171,27 @@ test_expect_success CGIT_LUA 'git can trace before the filters are set up' ' test -s trace2.out ' +# html_url_arg and html_include are the two calls a Lua filter has beyond +# plain html, and nothing else drives them. +test_expect_success CGIT_LUA 'a lua filter can encode an argument and include a file' ' + echo "included <b>bold</b>" >include.txt && + cat >apis.lua <<-EOF && + function filter_open(...) end + function filter_write(str) + html_url_arg("a b&c") + html("|") + html_include("$PWD/include.txt") + end + function filter_close() return 0 end + EOF + { + echo "cache-size=0" && + echo "repo.url=foo" && + echo "repo.path=$PWD/repos/foo/.git" && + echo "repo.commit-filter=lua:$PWD/apis.lua" + } >apisrc && + CGIT_CONFIG="$PWD/apisrc" QUERY_STRING="url=foo/commit" cgit >tmp && + grep "a+b%26c|included <b>bold</b>" tmp +' + test_done |
