From ebec23f614e504d195694a468de2fa50ebbfee68 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Wed, 13 Jul 2022 17:42:22 +0100 Subject: [PATCH] dev: generate more robust error message tests --- hledger/test/errors/Makefile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/hledger/test/errors/Makefile b/hledger/test/errors/Makefile index 3e6cc6e2c..3276924a3 100644 --- a/hledger/test/errors/Makefile +++ b/hledger/test/errors/Makefile @@ -13,7 +13,7 @@ tests: @printf "Updating *.test with the error messages of hledger $$(hledger --version | awk '{print $$2}')\n" @read -p "ok ? Press enter: " for f in $(TESTJOURNALS); do make -s $$(basename $$f .j).test; done - make -s test + @printf "\nNow please edit *.test and limit regexps to 300 chars to avoid shelltestrunner limitation\n\n" # Generate a shelltest. Run the test script/journal to generate the error message. # Since the error will contain an absolute file path, we must: @@ -27,10 +27,15 @@ tests: -./$< 2>&1 | sed -E \ -e 's%(hledger: Error: ).*/\./(.*)%\1.*\2%' \ -e 's%/%\\/%g' \ - -e 's%alias \\/\(\\/%alias \\/\\(\\/%' \ - -e 's%compiled: \(%compiled: \\(%' \ + -e 's/\^/\\^/g' \ + -e 's/\$$/\\$$/g' \ + -e 's/\(/\\(/g' \ + -e 's/\)/\\)/g' \ + -e 's/\|/\\|/g' \ >>$@ printf "/\n>>>= 1" >>$@ +# -e 's%alias \\/\(\\/%alias \\/\\(\\/%' \ +# -e 's%compiled: \(%compiled: \\(%' \ readme: $(TESTJOURNALS) @printf "Updating README.md with the error messages of hledger $$(hledger --version | awk '{print $$2}')\n"