From 651179b5da0777f861e427f96fd8560bf1516ae5 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Mon, 17 Dec 2018 11:55:11 -0500 Subject: Add simple JSON serializer --- libtests/qtest/json.test | 17 +++++++++++++++++ libtests/qtest/json/json.out | 23 +++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 libtests/qtest/json.test create mode 100644 libtests/qtest/json/json.out (limited to 'libtests/qtest') diff --git a/libtests/qtest/json.test b/libtests/qtest/json.test new file mode 100644 index 00000000..b62994d3 --- /dev/null +++ b/libtests/qtest/json.test @@ -0,0 +1,17 @@ +#!/usr/bin/env perl +require 5.008; +use warnings; +use strict; + +chdir("json") or die "chdir testdir failed: $!\n"; + +require TestDriver; + +my $td = new TestDriver('json'); + +$td->runtest("json", + {$td->COMMAND => "json"}, + {$td->FILE => "json.out", $td->EXIT_STATUS => 0}, + $td->NORMALIZE_NEWLINES); + +$td->report(1); diff --git a/libtests/qtest/json/json.out b/libtests/qtest/json/json.out new file mode 100644 index 00000000..f06cc1fb --- /dev/null +++ b/libtests/qtest/json/json.out @@ -0,0 +1,23 @@ +--- top-level type mismatch +top-level object is supposed to be a dictionary +--- +--- top-level type mismatch +json key "./one./a": key "/q" is present in schema but missing in object +json key "./one./a./r" is supposed to be a dictionary +json key "./one./a./s" is supposed to be an array +json key "./one./a": key "/t" is not present in schema but appears in object +json key "./two.1": key "/glarp" is present in schema but missing in object +json key "./two.1": key "/flarp" is not present in schema but appears in object +json key "./two.2" is supposed to be a dictionary +json key "./two.3" is supposed to be a dictionary +--- +--- top-level schema array error +top-level object schema array contains other than one item +--- +--- lower-level schema array error +json key "./one./a./r" schema array contains other than one item +json key "./two" schema array contains other than one item +--- +--- pass +--- +end of json tests -- cgit v1.2.3-54-g00ecf