summaryrefslogtreecommitdiffstats
path: root/tests/libzscanner/test_zscanner.in
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 15:24:08 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 15:24:08 +0000
commitf449f278dd3c70e479a035f50a9bb817a9b433ba (patch)
tree8ca2bfb785dda9bb4d573acdf9b42aea9cd51383 /tests/libzscanner/test_zscanner.in
parentInitial commit. (diff)
downloadknot-f449f278dd3c70e479a035f50a9bb817a9b433ba.tar.xz
knot-f449f278dd3c70e479a035f50a9bb817a9b433ba.zip
Adding upstream version 3.2.6.upstream/3.2.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/libzscanner/test_zscanner.in')
-rw-r--r--tests/libzscanner/test_zscanner.in41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/libzscanner/test_zscanner.in b/tests/libzscanner/test_zscanner.in
new file mode 100644
index 0000000..10d2b5c
--- /dev/null
+++ b/tests/libzscanner/test_zscanner.in
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+SOURCE=@top_srcdir@/tests/libzscanner
+BUILD=@top_builddir@/tests/libzscanner
+
+. @top_srcdir@/tests/tap/libtap.sh
+
+cd "$BUILD"
+
+TMPDIR=$(test_tmpdir)
+TESTS_DIR="$SOURCE"/data
+ZSCANNER_TOOL="$BUILD"/zscanner-tool
+
+plan 86
+
+mkdir -p "$TMPDIR"/includes/
+for a in 1 2 3 4 5 6; do
+ cat "$TESTS_DIR"/includes/include"$a" > "$TMPDIR"/includes/include"$a";
+done
+
+for case in $(cat "$SOURCE"/TESTS); do
+ casein=$(test_file_path data/"$case".in)
+ caseout=$(test_file_path data/"$case".out)
+ filein="$TMPDIR"/"$case".in
+ fileout="$TMPDIR"/"$case".out
+
+ sed -e "s|@TMPDIR@|$TMPDIR|;" < "$casein" > "$filein"
+
+ "$ZSCANNER_TOOL" -m 2 . "$filein" > "$fileout"
+
+ if cmp -s "$fileout" "$caseout"; then
+ ok "$case: output matches" true
+ rm "$filein"
+ rm "$fileout"
+ else
+ ok "$case: output differs" false
+ diff -urNap "$caseout" "$fileout" | while read line; do diag "$line"; done
+ fi
+done
+
+rm -rf "$TMPDIR"/includes/