summaryrefslogtreecommitdiffstats
path: root/libtests/qtest
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-01-19 15:31:28 +0100
committerJay Berkenbilt <ejb@ql.org>2022-01-30 19:11:03 +0100
commit37105710ee0b332a3020d4b3220c95b8f4267555 (patch)
treeee4b520b1c141033ba16ba3696def57fc90f60fa /libtests/qtest
parenta6df6fdaf724ed5fc6f7e8c021f7804bd5a9c0e2 (diff)
downloadqpdf-37105710ee0b332a3020d4b3220c95b8f4267555.tar.zst
Implement JSONHandler for recursively processing JSON
Diffstat (limited to 'libtests/qtest')
-rw-r--r--libtests/qtest/json_handler.test17
-rw-r--r--libtests/qtest/json_handler/json_handler.out22
2 files changed, 39 insertions, 0 deletions
diff --git a/libtests/qtest/json_handler.test b/libtests/qtest/json_handler.test
new file mode 100644
index 00000000..6df51fc1
--- /dev/null
+++ b/libtests/qtest/json_handler.test
@@ -0,0 +1,17 @@
+#!/usr/bin/env perl
+require 5.008;
+use warnings;
+use strict;
+
+chdir("json_handler") or die "chdir testdir failed: $!\n";
+
+require TestDriver;
+
+my $td = new TestDriver('json_handler');
+
+$td->runtest("JSON handler",
+ {$td->COMMAND => "json_handler"},
+ {$td->FILE => "json_handler.out", $td->EXIT_STATUS => 0},
+ $td->NORMALIZE_NEWLINES);
+
+$td->report(1);
diff --git a/libtests/qtest/json_handler/json_handler.out b/libtests/qtest/json_handler/json_handler.out
new file mode 100644
index 00000000..13554af3
--- /dev/null
+++ b/libtests/qtest/json_handler/json_handler.out
@@ -0,0 +1,22 @@
+-- scalar --
+.: string: potato
+-- all --
+.five[0]: string: x
+.five[1]: bool: false
+.five[2]: string: y
+.five[3]: null
+.five[4]: bool: true
+.four: json: [
+ "a",
+ 1
+]
+.one: string: potato
+.phour: json: null
+.six.a.Q: json: "baaa"
+.six.a.b: string: quack
+.six.b: string: moo
+.three: bool: true
+.two: number: 3.14
+-- errors --
+bad type at top: JSON handler: value at . is not of expected type
+unexpected key: JSON handler found unexpected key x in object at .