summary refs log tree commit diff
path: root/tests/t0105-commit.sh
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-12-27 18:45:04 -0500
committerJune McEnroe <june@causal.agency>2020-12-27 18:45:04 -0500
commit85016e706cd00e527dba3fa83b2783dfb56a4ffa (patch)
treefc28a97fede3b74ae2cb2e778ffd4c0ae59c637b /tests/t0105-commit.sh
downloadsrc-85016e706cd00e527dba3fa83b2783dfb56a4ffa.tar.gz
src-85016e706cd00e527dba3fa83b2783dfb56a4ffa.zip
Squashed 'www/git.causal.agency/cgit/' content from commit 02221fd3
git-subtree-dir: www/git.causal.agency/cgit
git-subtree-split: 02221fd3fe523a3293d64e3359036e3a71d6fd7e
Diffstat (limited to 'tests/t0105-commit.sh')
-rwxr-xr-xtests/t0105-commit.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/t0105-commit.sh b/tests/t0105-commit.sh
new file mode 100755
index 00000000..9cdf55c0
--- /dev/null
+++ b/tests/t0105-commit.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+test_description='Check content on commit page'
+. ./setup.sh
+
+test_expect_success 'generate foo/commit' 'cgit_url "foo/commit" >tmp'
+test_expect_success 'find tree link' 'grep "<a href=./foo/tree/.>" tmp'
+test_expect_success 'find parent link' 'grep -E "<a href=./foo/commit/\?id=.+>" tmp'
+
+test_expect_success 'find commit subject' '
+	grep "<div class=.commit-subject.>commit 5<" tmp
+'
+
+test_expect_success 'find commit msg' 'grep "<div class=.commit-msg.></div>" tmp'
+test_expect_success 'find diffstat' 'grep "<table summary=.diffstat. class=.diffstat.>" tmp'
+
+test_expect_success 'find diff summary' '
+	grep "1 files changed, 1 insertions, 0 deletions" tmp
+'
+
+test_expect_success 'get root commit' '
+	root=$(cd repos/foo && git rev-list --reverse HEAD | head -1) &&
+	cgit_url "foo/commit&id=$root" >tmp &&
+	grep "</html>" tmp
+'
+
+test_expect_success 'root commit contains diffstat' '
+	grep "<a href=./foo/diff/file-1.id=[0-9a-f]\{40\}.>file-1</a>" tmp
+'
+
+test_expect_success 'root commit contains diff' '
+	grep ">diff --git a/file-1 b/file-1<" tmp &&
+	grep "<div class=.add.>+1</div>" tmp
+'
+
+test_done