diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rwxr-xr-xtests/t0113-tag.sh46
1 file changed, 46 insertions, 0 deletions
diff --git a/tests/t0113-tag.sh b/tests/t0113-tag.sh
new file mode 100755
index 0000000..12ad1b4
--- /dev/null
+++ b/tests/t0113-tag.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+# The tag page. An annotated tag gets the same three column table as the
+# commit page, with the tagger and date on one row and the tag, object and
+# download rows spanning the rest, and its message follows with no blank
+# line between subject and body. A lightweight tag gets the shorter table.
+
+test_description='Check content on tag page'
+. ./setup.sh
+
+test_expect_success 'create an annotated and a lightweight tag' '
+ (
+ cd repos/foo &&
+ git tag -a -m "Annotated tag
+
+Release notes over
+two lines." v1.0 &&
+ git tag light
+ )
+'
+
+test_expect_success 'generate foo/tag/?h=v1.0' 'cgit_url "foo/tag/&h=v1.0" >tmp'
+
+test_expect_success 'find the tagger row with its date' '
+ grep "<tr><th>tagger</th><td>C O Mitter &lt;committer@example.com&gt;</td><td class=.right.><time datetime=" tmp
+'
+
+test_expect_success 'find the tag, object and download rows' '
+ grep "<tr><th>tag</th><td colspan=.2.>v1.0 (<span class=.oid.>[0-9a-f]*</span>)</td></tr>" tmp &&
+ grep "<tr><th>object</th><td colspan=.2. class=.oid.><a" tmp &&
+ grep "<tr><th>download</th><td colspan=.2. class=.oid.>" tmp
+'
+
+test_expect_success 'the message follows with no blank line before the body' '
+ tr -d "\n" <tmp >flat &&
+ grep "<div class=.commit-subject.>Annotated tag</div><div class=.commit-msg.>Release notes overtwo lines.</div>" flat
+'
+
+test_expect_success 'a lightweight tag gets the shorter table' '
+ cgit_url "foo/tag/&h=light" >tmp &&
+ grep "<tr><th>tag</th><td colspan=.2.>light</td></tr>" tmp &&
+ grep "<tr><th>object</th><td colspan=.2. class=.oid.><a" tmp &&
+ ! grep "<th>tagger</th>" tmp
+'
+
+test_done