Diff options
Diffstat (limited to 'tests')
-rwxr-xr-xtests/t0005-markup.sh22
-rwxr-xr-xtests/t0109-patch.sh18
2 files changed, 36 insertions, 4 deletions
diff --git a/tests/t0005-markup.sh b/tests/t0005-markup.sh
index 52d9e34..5fa866d 100755
--- a/tests/t0005-markup.sh
+++ b/tests/t0005-markup.sh
@@ -44,6 +44,28 @@ test_expect_success 'the landmarks and the search form are in place' '
grep "<footer class=.footer.>" tmp
'
+test_expect_success 'the pages name the versions only when asked to' '
+ hooks "hooks/" >footer &&
+ grep "<meta name=.generator. content=.cgit.>" footer &&
+ grep "<footer class=.footer.>generated by <a href=[^>]*>cgit</a></footer>" footer &&
+ {
+ echo "enable-version-info=1" &&
+ cat hooksrc
+ } >versionrc &&
+ CGIT_CONFIG="$PWD/versionrc" QUERY_STRING="url=hooks/" cgit >footer &&
+ grep "<meta name=.generator. content=.cgit v[0-9][^>]*>" footer &&
+ grep "<footer class=.footer.>generated by <a href=[^>]*>cgit v[0-9][^<]*</a> (<a href=[^>]*>git [0-9][^<]*</a>)</footer>" footer &&
+ echo "<footer>our own</footer>" >footer.html &&
+ {
+ echo "enable-version-info=1" &&
+ echo "footer=$PWD/footer.html" &&
+ cat hooksrc
+ } >versionrc &&
+ CGIT_CONFIG="$PWD/versionrc" QUERY_STRING="url=hooks/" cgit >footer &&
+ grep "<footer>our own</footer>" footer &&
+ ! grep "git-scm" footer
+'
+
test_expect_success 'the listings name themselves, their sections and their rows' '
grep "<table class=.list log. aria-label=.Commits.>" tmp &&
grep "<tbody class=.log.>" tmp &&
diff --git a/tests/t0109-patch.sh b/tests/t0109-patch.sh
index 0c4bf8c..6840f0c 100755
--- a/tests/t0109-patch.sh
+++ b/tests/t0109-patch.sh
@@ -12,9 +12,10 @@ test_description='Check content on patch page'
# tag, as git writes its own.
CGIT_VERSION=$(sed -n "s/CGIT_VERSION = v\{0,1\}//p" "$TEST_OUTPUT_DIRECTORY/../build/VERSION")
-# The signature sits on the second-to-last line, above the trailing blank.
+# The signature sits on the second-to-last line, above the trailing blank,
+# and names the version only when enable-version-info asks for it.
check_cgit_signature() {
- tail -2 tmp | head -1 | grep -x -F "cgit $CGIT_VERSION"
+ tail -2 tmp | head -1 | grep -x -F "cgit${1:+ $1}"
}
test_expect_success 'generate foo/patch' '
@@ -39,7 +40,7 @@ test_expect_success 'find `cgit` signature' '
test_expect_success 'compare with output of git-format-patch(1)' '
git --git-dir="$PWD/repos/foo/.git" format-patch --subject-prefix="" \
- --signature="cgit $CGIT_VERSION" --stdout HEAD^ >tmp2 &&
+ --signature="cgit" --stdout HEAD^ >tmp2 &&
strip_headers <tmp >tmp_ &&
test_cmp tmp_ tmp2
'
@@ -68,7 +69,7 @@ test_expect_success 'find `cgit` signature on the range' '
test_expect_success 'compare the range with git-format-patch(1)' '
git --git-dir="$PWD/repos/foo/.git" format-patch --subject-prefix="" \
- -N --signature="cgit $CGIT_VERSION" --stdout HEAD~3..HEAD >tmp2 &&
+ -N --signature="cgit" --stdout HEAD~3..HEAD >tmp2 &&
strip_headers <tmp >tmp_ &&
test_cmp tmp_ tmp2
'
@@ -86,4 +87,13 @@ test_expect_success 'max-patch-count bounds a patch range' '
test $(grep -c "^From " tmp) -eq 2
'
+test_expect_success 'the signature names the version when asked to' '
+ {
+ echo "enable-version-info=1" &&
+ sed "s/^cache-size=.*/cache-size=0/" cgitrc
+ } >versionrc &&
+ CGIT_CONFIG="$PWD/versionrc" QUERY_STRING="url=foo/patch" cgit >tmp &&
+ check_cgit_signature "$CGIT_VERSION"
+'
+
test_done