blob: 12ad1b4ab182a4e5f842dcff622a530aa6af03be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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