pandoc-lua-filters/Makefile
2022-10-29 19:47:05 +02:00

24 lines
924 B
Makefile

.PHONY: test-all test-internal
SHELL=/bin/bash
return_statement_line_number := $(shell grep -nE '^return' text-crossrefs.lua | cut -d ':' -f 1)
line_before_return := $(shell echo $$(($(return_statement_line_number) - 1)))
test-all: test-internal test-context test-latex test-opendocument
test-internal: text-crossrefs.lua
-rm --interactive=never test/tmp.lua
sed -n 1,$(line_before_return)p text-crossrefs.lua > test/tmp.lua
cat test/test-functions.lua >> test/tmp.lua
chmod -w test/tmp.lua
pandoc -L test/tmp.lua <<< ''
@echo -e '==========================\nAll internal tests passed.\n==========================\n'
rm --interactive=never test/tmp.lua
test-%: text-crossrefs.lua sample.md
TESTED_FORMAT=$* pandoc -t native -L text-crossrefs.lua sample.md > test/tmp-$*.native
diff test/tmp-$*.native test/sample-$*.native
@echo -e '\n===============\ntest passed.\n===============\n'
rm test/tmp-$*.native