From 8f379c77fcd2f95d16838feec6d1b7f3f0c51101 Mon Sep 17 00:00:00 2001 From: Nikolay Yakimov Date: Tue, 5 Mar 2024 09:22:24 +0300 Subject: [PATCH] Makefile action to regenerate test fixtures --- .gitignore | 2 -- Makefile | 3 +++ mkcheck.sh | 4 ++++ mkinttest.sh | 20 ++++++++++++++++++++ 4 files changed, 27 insertions(+), 2 deletions(-) create mode 100755 mkcheck.sh create mode 100755 mkinttest.sh diff --git a/.gitignore b/.gitignore index 72f55f38..b25a1d2f 100644 --- a/.gitignore +++ b/.gitignore @@ -9,8 +9,6 @@ cabal.project.local~ dist dist-newstyle cabal.sandbox.config -mkcheck.sh -mkinttest.sh /pandoc-crossref /*.tar.gz /result* diff --git a/Makefile b/Makefile index 776ec862..b0b09245 100644 --- a/Makefile +++ b/Makefile @@ -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) diff --git a/mkcheck.sh b/mkcheck.sh new file mode 100755 index 00000000..a789f18f --- /dev/null +++ b/mkcheck.sh @@ -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 diff --git a/mkinttest.sh b/mkinttest.sh new file mode 100755 index 00000000..a8293bfa --- /dev/null +++ b/mkinttest.sh @@ -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