Skip to content

Commit

Permalink
Makefile action to regenerate test fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
lierdakil committed Mar 5, 2024
1 parent 0445baf commit 8f379c7
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ cabal.project.local~
dist
dist-newstyle
cabal.sandbox.config
mkcheck.sh
mkinttest.sh
/pandoc-crossref
/*.tar.gz
/result*
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ push:
test:
nix run .#test && nix run .#test-integrative

regen-test-fixtures:
nix develop --command bash -c './mkcheck.sh && ./mkinttest.sh'

cabal.project.freeze:
cabal freeze --constraint pandoc==$$(yq '.env.PANDOC_VERSION' .github/workflows/haskell.yml)

Expand Down
4 changes: 4 additions & 0 deletions mkcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash

pandoc -F pandoc-crossref -i docs/demo/demo.md -t native | sed 's/^/ /' > test/demo.inc
pandoc --top-level-division=chapter -Mchapters -F pandoc-crossref -i docs/demo/demo.md -t native | sed 's/^/ /' > test/demo-chapters.inc
20 changes: 20 additions & 0 deletions mkinttest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

branch="$(git branch --show-current)"

pd=pandoc
pc=pandoc-crossref

find test/m2m -iname 'input.md' -print | while read i; do
echo $i
dn="$(dirname "$i")"
bdn="$(basename "$dn")"
listings=""
if [ "${bdn%%-*}" == "listings" ]; then
listings="--listings"
fi
"$pd" -F "$pc" "$i" -t markdown-raw_attribute-raw_html -o "$dn/expect.md"
case "$branch" in
"master") "$pd" -F "$pc" "$i" $listings -t latex -o "$dn/expect.tex";;
esac
done

0 comments on commit 8f379c7

Please sign in to comment.