aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLibravatar Alexander Foremny <aforemny@posteo.de>2023-12-18 13:50:22 +0100
committerLibravatar Alexander Foremny <aforemny@posteo.de>2024-03-25 07:42:51 +0100
commitfc0afaaa273f5b5d3696df87d70d5347a13bb9ac (patch)
treea7e48842f71511f39a367e5dff84f41c02f3d859 /test
parent812fcbadae72960d200286355c9aaecfbe350bf2 (diff)
feat: compute history top to bottom
Disables caching.
Diffstat (limited to 'test')
-rw-r--r--test/Main.hs85
1 files changed, 85 insertions, 0 deletions
diff --git a/test/Main.hs b/test/Main.hs
new file mode 100644
index 0000000..ae11911
--- /dev/null
+++ b/test/Main.hs
@@ -0,0 +1,85 @@
+module Main (main) where
+
+import Process.Shell (sh)
+import Test.Hspec (describe, hspec, it, shouldBe)
+
+main :: IO ()
+main = do
+ anissue :: String <- [sh|realpath dist-newstyle/build/*/*/anissue-*/x/anissue/build/anissue|]
+ hspec do
+ describe "issue events" do
+ it "smoke" do
+ ( `shouldBe`
+ concat
+ [ "df7c026 created issue 1\n",
+ "55b493c deleted issue 1\n",
+ "618907d changed issue 1\n",
+ "618907d created issue 2\n",
+ "e95b4ec created issue 1"
+ ]
+ )
+ . 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 log|]