From eb63aa06a45bc68e15eab26c46ecdaf21f82b9d2 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Wed, 17 Jun 2020 11:32:06 +0100 Subject: [PATCH] corrected setup of data directory for tests --- pdf2htmlEX/test/produceHtmlForBrowserTests | 25 ++++++++++++++++++++++ pdf2htmlEX/test/testOutput | 12 +++++++---- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/pdf2htmlEX/test/produceHtmlForBrowserTests b/pdf2htmlEX/test/produceHtmlForBrowserTests index 3ef8f0f..2fdce82 100755 --- a/pdf2htmlEX/test/produceHtmlForBrowserTests +++ b/pdf2htmlEX/test/produceHtmlForBrowserTests @@ -35,6 +35,23 @@ function runPdf2htmlEX { $htmlFileName } +# This is how we copy a file omitting lines between '#TEST_IGNORE_BEGIN' +# and '#TEST_IGNORE_END' (we pipe the file in via stdin and save it via +# stdout) +# +function copy_TEST_IGNORE_file { + skipLine=echo + while IFS= read -r line ; do + if echo $line | grep -q "^#TEST_IGNORE_BEGIN" ; then + skipLine=true + elif echo $line | grep -q "^#TEST_IGNORE_END" ; then + skipLine=echo + else + $skipLine "$line" + fi + done +} + if test -z "$PDF2HTMLEX_PATH" ; then echo "PANIC: we do not know where to find the pdf2htmlEX executable" exit 1 @@ -58,6 +75,14 @@ rm -rf $PDF2HTMLEX_TMPDIR mkdir -p $PDF2HTMLEX_TMPDIR # +# setup the correct data files +# +cat $PDF2HTMLEX_TEST_DIR/../share/manifest | \ + copy_TEST_IGNORE_file > $PDF2HTMLEX_DATDIR/manifest + +cp $PDF2HTMLEX_TEST_DIR/../share/base.min.css $PDF2HTMLEX_DATDIR +cp $PDF2HTMLEX_TEST_DIR/../test/fancy.min.css $PDF2HTMLEX_DATDIR + runPdf2htmlEX 'test_fail.pdf' runPdf2htmlEX 'basic_text.pdf' diff --git a/pdf2htmlEX/test/testOutput b/pdf2htmlEX/test/testOutput index a74afd1..c18ebdb 100755 --- a/pdf2htmlEX/test/testOutput +++ b/pdf2htmlEX/test/testOutput @@ -60,9 +60,13 @@ function hasExpectedFiles { function copy_TEST_IGNORE_file { skipLine=echo while IFS= read -r line ; do - if echo $line | grep -q "TEST_IGNORE_BEGIN" ; then skipLine=true ; fi - if echo $line | grep -q "TEST_IGNORE_END" ; then skipLine=echo ; fi - $skipLine "$line" + if echo $line | grep -q "^#TEST_IGNORE_BEGIN" ; then + skipLine=true + elif echo $line | grep -q "^#TEST_IGNORE_END" ; then + skipLine=echo + else + $skipLine "$line" + fi done } @@ -99,7 +103,7 @@ cat $PDF2HTMLEX_TEST_DIR/../share/manifest | \ copy_TEST_IGNORE_file > $PDF2HTMLEX_DATDIR/manifest cp $PDF2HTMLEX_TEST_DIR/../share/base.min.css $PDF2HTMLEX_DATDIR -cp $PDF2HTMLEX_TEST_DIR/../share/fancy.min.css $PDF2HTMLEX_DATDIR +cp $PDF2HTMLEX_TEST_DIR/../test/fancy.min.css $PDF2HTMLEX_DATDIR # Do the tests #