aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Alexander Foremny <aforemny@posteo.de>2024-03-25 14:30:51 +0100
committerLibravatar Alexander Foremny <aforemny@posteo.de>2024-03-25 14:41:47 +0100
commit69a1291ccf88fb0c6b521dd4c53c07d8b9006f3e (patch)
treee73de1f2e9dba70b3cc2df8240f8784f6ccb31d0
parent03b5c39079673e3d9c80c54f28e196fede3f69e4 (diff)
chore: add smoke test for `anissue list`
-rw-r--r--test/Main.hs74
1 files changed, 74 insertions, 0 deletions
diff --git a/test/Main.hs b/test/Main.hs
index ae11911..46b4e06 100644
--- a/test/Main.hs
+++ b/test/Main.hs
@@ -83,3 +83,77 @@ git commit -m 'reopen issue 1'
) 1>/dev/null
anissue log|]
+ describe "issues" do
+ it "smoke" do
+ ( `shouldBe`
+ concat
+ [ "issue 2 on 1970-01-01 by Jane Doe\n",
+ "\n",
+ "issue 1 on 1970-01-01 by Jane Doe"
+ ]
+ )
+ . fst @String @()
+ =<< [sh|
+set -efu
+PATH=#{anissue}${PATH+:$PATH}; export PATH
+readonly tmp=$(mktemp -d)
+trap 'rm -rf "$tmp"' EXIT
+cd "$tmp"
+
+GIT_AUTHOR_DATE="Thu Jan 1 00:00:00 1970 +0000"; export GIT_AUTHOR_DATE
+GIT_AUTHOR_EMAIL="jane@example.com"; export GIT_AUTHOR_EMAIL
+GIT_AUTHOR_NAME="Jane Doe"; export GIT_AUTHOR_NAME
+GIT_COMMITTER_DATE="Thu Jan 1 00:00:00 1970 +0000"; export GIT_COMMITTER_DATE
+GIT_COMMITTER_EMAIL="jane@example.com"; export GIT_COMMITTER_EMAIL
+GIT_COMMITTER_NAME="Jane Doe"; export GIT_COMMITTER_NAME
+
+(
+git init --initial-branch=main
+
+cat >main.hs <<'EOF'
+module Main where
+EOF
+git add main.hs
+git commit -m 'no issues'
+
+cat >main.hs <<'EOF'
+module Main where
+
+-- TODO issue 1
+EOF
+git add main.hs
+git commit -m 'create issue 1'
+
+cat >main.hs <<'EOF'
+module Main where
+
+-- TODO issue 2
+EOF
+cat >lib.hs <<'EOF'
+module Main where
+
+-- TODO issue 1
+--
+-- remark: file modifications are not considered changes!
+EOF
+git add main.hs lib.hs
+git commit -m 'create issue 2, modify issue 1'
+
+cat >lib.hs <<'EOF'
+module Main where
+EOF
+git add lib.hs
+git commit -m 'close issue 1'
+
+cat >lib.hs <<'EOF'
+module Main where
+
+-- TODO issue 1
+--
+-- remark: file changes are not considered changes!
+EOF
+git add main.hs lib.hs
+git commit -m 'reopen issue 1'
+) 1>/dev/null
+
+anissue list|]