Diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Hold the tag tests to a working page
The tag requests passed on any answer short of a crash, and the title
test read a page the cache kept from an earlier test. The id pattern
also matched an empty id, the date row was checked only for its
opening tag, and the lightweight tag was never shown to lack a date
row. Two tests read a page an earlier test wrote.
| -rwxr-xr-x | tests/t0113-tag.sh | 30 |
1 file changed, 16 insertions, 14 deletions
diff --git a/tests/t0113-tag.sh b/tests/t0113-tag.sh index 19b2283..2a95a36 100755 --- a/tests/t0113-tag.sh +++ b/tests/t0113-tag.sh @@ -3,7 +3,7 @@ # The tag page. An annotated tag gets a table of its name, date, tagger, the # object it points at under its full id, and the downloads, and its message # follows with no blank line between subject and body. A lightweight tag gets -# the shorter table. +# the shorter table. The tags the first test makes serve the rest. test_description='Check content on tag page' . ./setup.sh @@ -19,16 +19,17 @@ two lines." v1.0 && ) ' -test_expect_success 'generate foo/tag/?h=v1.0' 'cgit_url "foo/tag/&h=v1.0" >tmp' - test_expect_success 'find the name, date and tagger rows' ' - grep "<tr><th scope=.row.>tag name</th><td>v1.0 (<span class=.oid.>[0-9a-f]*</span>)</td></tr>" tmp && - grep "<tr><th scope=.row.>tag date</th><td><time datetime=" tmp && - grep "<tr><th scope=.row.>tagged by</th><td>C O Mitter <committer@example.com></td></tr>" tmp + tag=$(git -C repos/foo rev-parse v1.0) && + cgit_ok_url "foo/tag/&h=v1.0" >tmp && + test_grep "<tr><th scope=.row.>tag name</th><td>v1.0 (<span class=.oid.>$tag</span>)</td></tr>" tmp && + test_grep "<tr><th scope=.row.>tag date</th><td><time datetime=.2005-04-01T13:14:15+02:00.>2005-04-01 13:14:15 +0200</time></td></tr>" tmp && + test_grep "<tr><th scope=.row.>tagged by</th><td>C O Mitter <committer@example.com></td></tr>" tmp ' test_expect_success 'the object row names the full commit id' ' commit=$(git -C repos/foo rev-parse v1.0^{commit}) && + cgit_ok_url "foo/tag/&h=v1.0" >tmp && grep "<tr><th scope=.row.>tagged object</th><td class=.oid.><a href=./foo/commit/?h=v1.0&id=$commit.>commit $commit</a></td></tr>" tmp && grep "<tr><th scope=.row.>download</th><td class=.oid.>" tmp ' @@ -40,22 +41,23 @@ test_expect_success 'the message follows with no blank line before the body' ' ' test_expect_success 'a lightweight tag gets the shorter table' ' - cgit_url "foo/tag/&h=light" >tmp && + cgit_ok_url "foo/tag/&h=light" >tmp && grep "<tr><th scope=.row.>tag name</th><td>light</td></tr>" tmp && grep "<tr><th scope=.row.>tagged object</th><td class=.oid.><a" tmp && - ! grep "<th scope=.row.>tagged by</th>" tmp + test_grep ! "<th scope=.row.>tag date</th>" tmp && + test_grep ! "<th scope=.row.>tagged by</th>" tmp ' # A snapshot is cut from a commit, so a tag of a tree or a blob offers none. test_expect_success 'a tag of anything but a commit offers no download' ' git -C repos/foo tag -a -m "a tree" tree-tag HEAD^{tree} && git -C repos/foo tag blob-tag HEAD:file-1 && - cgit_url "foo/tag/&h=tree-tag" >tmp && + cgit_ok_url "foo/tag/&h=tree-tag" >tmp && grep "tagged object" tmp && - ! grep ">download<" tmp && - cgit_url "foo/tag/&h=blob-tag" >tmp && + test_grep ! ">download<" tmp && + cgit_ok_url "foo/tag/&h=blob-tag" >tmp && grep "tagged object" tmp && - ! grep ">download<" tmp + test_grep ! ">download<" tmp ' # git reads the signature off the end of a tag's message, so a block shaped @@ -79,13 +81,13 @@ test_expect_success 'a signed tag shows its signature in the message' ' } >signed-tag && git update-ref refs/tags/signed $(git mktag <signed-tag) ) && - cgit_url "foo/tag/&h=signed" >tmp && + cgit_ok_url "foo/tag/&h=signed" >tmp && tr -d "\n" <tmp >flat && grep "<div class=.commit-msg.>Notes.-----BEGIN PGP SIGNATURE-----iQEzBAABCAAdFiEE-----END PGP SIGNATURE-----</div>" flat ' test_expect_success 'a tag page names the tag in its title' ' - cgit_url "foo/tag/&h=v1.0" >tmp && + cgit_ok_url "foo/tag/&h=v1.0" >tmp && grep "<title>v1.0 - foo - Git repository browser</title>" tmp ' |
