doc/Makefile
src/Makefile
test/Makefile
- test/testdata/Makefile
- test/testprogs/Makefile
+ test/bin/Makefile
+ test/suites/Makefile
+ test/suites/api/Makefile
])
AC_OUTPUT
-loadf_dumpf
-loads_dumps
-load_file_dump_file
-testlogs
-testprogs/test_array
-testprogs/test_dump
-testprogs/test_load
-testprogs/test_number
-testprogs/test_object
-testprogs/test_simple
+logs
+bin/json_process
+suites/api/test_array
+suites/api/test_dump
+suites/api/test_load
+suites/api/test_number
+suites/api/test_object
+suites/api/test_simple
-DIST_SUBDIRS = testprogs testdata
-SUBDIRS = testprogs
+SUBDIRS = bin suites
+EXTRA_DIST = scripts
-check_PROGRAMS = loadf_dumpf loads_dumps load_file_dump_file
-
-AM_CPPFLAGS = -I$(top_srcdir)/src
-AM_CFLAGS = -Wall -Werror
-LDFLAGS = -static # for speed and Valgrind
-LDADD = ../src/libjansson.la
-
-TESTS = test-api test-invalid test-valid
-
-EXTRA_DIST = \
- test-api \
- test-invalid \
- test-valid \
- run-test \
- json-compare.py \
- split-testfile.py
+TESTS = run-suites
+TESTS_ENVIRONMENT = \
+ top_srcdir=$(top_srcdir) \
+ top_builddir=$(top_builddir)
clean-local:
- rm -rf testlogs
+ rm -rf logs
--- /dev/null
+check_PROGRAMS = json_process
+
+AM_CPPFLAGS = -I$(top_srcdir)/src
+AM_CFLAGS = -Wall -Werror
+LDFLAGS = -static # for speed and Valgrind
+LDADD = $(top_builddir)/src/libjansson.la
--- /dev/null
+/*
+ * Copyright (c) 2009 Petri Lehtinen <petri@digip.org>
+ *
+ * Jansson is free software; you can redistribute it and/or modify
+ * it under the terms of the MIT license. See LICENSE for details.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <jansson.h>
+
+static int getenv_int(const char *name)
+{
+ char *value, *end;
+ long result;
+
+ value = getenv(name);
+ if(!value)
+ return 0;
+
+ result = strtol(value, &end, 10);
+ if(*end != '\0')
+ return 0;
+
+ return (int)result;
+}
+
+int main(int argc, char *argv[])
+{
+ int indent = 0;
+ unsigned int flags = 0;
+
+ json_t *json;
+ json_error_t error;
+
+ if(argc != 1) {
+ fprintf(stderr, "usage: %s\n", argv[0]);
+ return 2;
+ }
+
+ indent = getenv_int("JSON_INDENT");
+ if(indent < 0 || indent > 255) {
+ fprintf(stderr, "invalid value for JSON_INDENT: %d\n", indent);
+ return 2;
+ }
+
+ if(indent > 0)
+ flags |= JSON_INDENT(indent);
+
+ if(getenv_int("JSON_COMPACT") > 0)
+ flags |= JSON_COMPACT;
+
+ if(getenv_int("JSON_ENSURE_ASCII"))
+ flags |= JSON_ENSURE_ASCII;
+
+ json = json_loadf(stdin, &error);
+ if(!json) {
+ fprintf(stderr, "%d\n%s\n", error.line, error.text);
+ return 1;
+ }
+
+ json_dumpf(json, stdout, flags);
+ json_decref(json);
+
+ return 0;
+}
+++ /dev/null
-#!/usr/bin/python
-#
-# Copyright (c) 2009 Petri Lehtinen <petri@digip.org>
-#
-# Jansson is free software; you can redistribute it and/or modify
-# it under the terms of the MIT license. See LICENSE for details.
-
-import sys
-try:
- import json
-except ImportError:
- import simplejson as json
-
-def load(filename):
- try:
- jsonfile = open(filename)
- except IOError, err:
- print >>sys.stderr, "unable to load %s: %s" % \
- (filename, err.strerror)
- sys.exit(1)
-
- try:
- jsondata = json.load(jsonfile)
- except ValueError, err:
- print "%s is malformed: %s" % (filename, err)
- sys.exit(1)
- finally:
- jsonfile.close()
-
- return jsondata
-
-def main():
- if len(sys.argv) != 3:
- print >>sys.stderr, "usage: %s json1 json2" % sys.argv[0]
- return 2
-
- json1 = load(sys.argv[1])
- json2 = load(sys.argv[2])
- if json1 == json2:
- return 0
- else:
- return 1
-
-if __name__ == '__main__':
- sys.exit(main() or 0)
+++ /dev/null
-/*
- * Copyright (c) 2009 Petri Lehtinen <petri@digip.org>
- *
- * Jansson is free software; you can redistribute it and/or modify
- * it under the terms of the MIT license. See LICENSE for details.
- */
-
-#include <stdio.h>
-#include <jansson.h>
-
-int main(int argc, char *argv[])
-{
- json_t *json;
- json_error_t error;
-
- if(argc != 3) {
- fprintf(stderr, "usage: %s infile outfile\n", argv[0]);
- return 2;
- }
-
- json = json_load_file(argv[1], &error);
- if(!json) {
- fprintf(stderr, "%d\n%s\n", error.line, error.text);
- return 1;
- }
-
- json_dump_file(json, argv[2], 0);
- json_decref(json);
-
- return 0;
-}
+++ /dev/null
-/*
- * Copyright (c) 2009 Petri Lehtinen <petri@digip.org>
- *
- * Jansson is free software; you can redistribute it and/or modify
- * it under the terms of the MIT license. See LICENSE for details.
- */
-
-#include <stdio.h>
-#include <jansson.h>
-
-int main(int argc, char *argv[])
-{
- json_t *json;
- json_error_t error;
-
- if(argc != 1) {
- fprintf(stderr, "usage: %s\n", argv[0]);
- return 2;
- }
-
- json = json_loadf(stdin, &error);
- if(!json) {
- fprintf(stderr, "%d\n%s\n", error.line, error.text);
- return 1;
- }
-
- /* loadf_dumpf indents, others don't, so dumping with and without
- indenting is tested */
- json_dumpf(json, stdout, JSON_INDENT(4));
- json_decref(json);
-
- return 0;
-}
+++ /dev/null
-/*
- * Copyright (c) 2009 Petri Lehtinen <petri@digip.org>
- *
- * Jansson is free software; you can redistribute it and/or modify
- * it under the terms of the MIT license. See LICENSE for details.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <jansson.h>
-
-#define BUFFER_SIZE (256 * 1024)
-
-int main(int argc, char *argv[])
-{
- json_t *json;
- json_error_t error;
- int count;
- char buffer[BUFFER_SIZE];
- char *result;
-
- if(argc != 1) {
- fprintf(stderr, "usage: %s\n", argv[0]);
- return 2;
- }
-
- count = fread(buffer, 1, BUFFER_SIZE, stdin);
- if(count < 0 || count >= BUFFER_SIZE) {
- fprintf(stderr, "unable to read input\n");
- return 1;
- }
- buffer[count] = '\0';
-
- json = json_loads(buffer, &error);
- if(!json) {
- fprintf(stderr, "%d\n%s\n", error.line, error.text);
- return 1;
- }
-
- result = json_dumps(json, 0);
- json_decref(json);
-
- puts(result);
- free(result);
-
- return 0;
-}
--- /dev/null
+#!/bin/sh
+
+while [ -n "$1" ]; do
+ suite=$1
+ if [ -x $top_srcdir/test/suites/$suite/run ]; then
+ SUITES="$SUITES $suite"
+ else
+ echo "No such suite: $suite"
+ exit 1
+ fi
+ shift
+done
+
+if [ -z "$SUITES" ]; then
+ suitedirs=$top_srcdir/test/suites/*
+ for suitedir in $suitedirs; do
+ if [ -x $suitedir/run ]; then
+ SUITES="$SUITES `basename $suitedir`"
+ fi
+ done
+fi
+
+export suites_srcdir=$top_srcdir/test/suites
+export suites_builddir=suites
+export scriptdir=$top_srcdir/test/scripts
+export logdir=logs
+export bindir=bin
+
+passed=0
+failed=0
+for suite in $SUITES; do
+ echo "Suite: $suite"
+ if $suites_srcdir/$suite/run $suite; then
+ passed=$(($passed+1))
+ else
+ failed=$(($failed+1))
+ fi
+done
+
+if [ $failed -gt 0 ]; then
+ echo "$failed of $((passed+failed)) test suites failed"
+ exit 1
+else
+ echo "$passed test suites passed"
+ rm -rf $logdir
+fi
+++ /dev/null
-# Copyright (c) 2009 Petri Lehtinen <petri@digip.org>
-#
-# Jansson is free software; you can redistribute it and/or modify
-# it under the terms of the MIT license. See LICENSE for details.
-
-VALGRIND_CMDLINE="valgrind --leak-check=full --show-reachable=yes --track-origins=yes -q"
-
-run_testprog() {
- local prog=$1
- local prefix=$2
- if [ -n "$VALGRIND" ]; then
- local runner="$VALGRIND_CMDLINE "
- fi
-
- case "$prog" in
- load_file_dump_file)
- $runner./$prog \
- $prefix.in \
- $prefix.$prog.stdout \
- 2>$prefix.$prog.stderr
- ;;
- *)
- $runner./$prog \
- <$prefix.in \
- >$prefix.$prog.stdout \
- 2>$prefix.$prog.stderr
- ;;
- esac
-
- if [ -n "$VALGRIND" ]; then
- # Check for Valgrind error output. The valgrind option
- # --error-exitcode is not enough because Valgrind doesn't
- # think unfreed allocs are errors.
- if grep -E -q '^==[0-9]+== ' $prefix.$prog.stderr; then
- echo "### $prefix ($prog) failed:" >&2
- echo "valgrind detected an error" >&2
- echo "for details, see test/$prefix.$prog.stderr" >&2
- exit 1
- fi
- fi
-}
-
-for testfile in $TESTFILES; do
- tmpdir="testlogs/`basename $testfile`"
- rm -rf $tmpdir
- mkdir -p $tmpdir
- if echo "$testfile" | grep -q -E -e '-strip$'; then
- opts="--strip"
- fi
- ${srcdir}/split-testfile.py $opts $testfile $tmpdir | while read name; do
- run_test loadf_dumpf $tmpdir/$name
- run_test loads_dumps $tmpdir/$name
- run_test load_file_dump_file $tmpdir/$name
- echo -n '.'
- done || exit 1
- echo
-done
--- /dev/null
+# Copyright (c) 2009 Petri Lehtinen <petri@digip.org>
+#
+# Jansson is free software; you can redistribute it and/or modify
+# it under the terms of the MIT license. See LICENSE for details.
+
+json_process=$bindir/json_process
+
+suite_name=$1
+suite_srcdir=$suites_srcdir/$suite_name
+suite_builddir=$suites_builddir/$suite_name
+suite_log=$logdir/$suite_name
+
+
+[ -z "$VERBOSE" ] && VERBOSE=0
+
+. $scriptdir/valgrind.sh
+
+rm -rf $suite_log
+mkdir -p $suite_log
+
+for test_path in $suite_srcdir/*; do
+ test_name=$(basename $test_path)
+ test_builddir=$suite_builddir/$test_name
+ test_log=$suite_log/$test_name
+
+ [ "$test_name" = "run" ] && continue
+ is_test || continue
+
+ rm -rf $test_log
+ mkdir -p $test_log
+ if [ $VERBOSE -eq 1 ]; then
+ echo -n "$name... "
+ fi
+
+ if run_test; then
+ # Success
+ if [ $VERBOSE -eq 1 ]; then
+ echo "ok"
+ else
+ echo -n "."
+ fi
+ rm -rf $test_log
+ else
+ # Failure
+ if [ $VERBOSE -eq 1 ]; then
+ echo "FAILED"
+ else
+ echo -n "F"
+ fi
+ fi
+done
+
+if [ $VERBOSE -eq 0 ]; then
+ echo
+fi
+
+if [ -n "$(ls -A $suite_log)" ]; then
+ for test_log in $suite_log/*; do
+ test_name=$(basename $test_log)
+ test_path=$suite_srcdir/$test_name
+ echo "================================================================="
+ echo "$suite_name/$test_name"
+ echo "================================================================="
+ show_error
+ echo
+ done
+ echo "================================================================="
+ exit 1
+else
+ rm -rf $suite_log
+fi
--- /dev/null
+# Copyright (c) 2009 Petri Lehtinen <petri@digip.org>
+#
+# Jansson is free software; you can redistribute it and/or modify
+# it under the terms of the MIT license. See LICENSE for details.
+
+[ -z "$VALGRIND" ] && VALGRIND=0
+
+VALGRIND_CMDLINE="valgrind --leak-check=full --show-reachable=yes --track-origins=yes -q"
+
+if [ $VALGRIND -eq 1 ]; then
+ json_process="$VALGRIND_CMDLINE $json_process"
+fi
+
+valgrind_check() {
+ if [ $VALGRIND -eq 1 ]; then
+ # Check for Valgrind error output. The valgrind option
+ # --error-exitcode is not enough because Valgrind doesn't
+ # think unfreed allocs are errors.
+ if grep -E -q '^==[0-9]+== ' $1; then
+ touch $test_log/valgrind_error
+ return 1
+ fi
+ fi
+}
+
+valgrind_show_error() {
+ if [ $VALGRIND -eq 1 -a -f $test_log/valgrind_error ]; then
+ echo "valgrind detected an error"
+ return 0
+ fi
+ return 1
+}
+++ /dev/null
-#!/usr/bin/python
-#
-# Copyright (c) 2009 Petri Lehtinen <petri@digip.org>
-#
-# Jansson is free software; you can redistribute it and/or modify
-# it under the terms of the MIT license. See LICENSE for details.
-
-import os
-import sys
-from optparse import OptionParser
-
-def strip_file(filename):
- with open(filename) as fobj:
- data = fobj.read()
- with open(filename, 'w') as fobj:
- fobj.write(data.strip())
-
-def open_files(outdir, i, name):
- basename = '%02d_%s' % (i, name)
- print basename
- input_path = os.path.join(outdir, basename + '.in')
- output_path = os.path.join(outdir, basename + '.out')
- return open(input_path, 'w'), open(output_path, 'w')
-
-def main():
- parser = OptionParser('usage: %prog [options] inputfile outputdir')
- parser.add_option('--strip', help='strip whitespace from input',
- action='store_true', default=False)
- options, args = parser.parse_args()
-
- if len(args) != 2:
- parser.print_help()
- return 2
-
- infile = os.path.normpath(args[0])
- outdir = os.path.normpath(args[1])
-
- if not os.path.exists(outdir):
- print >>sys.stderr, 'output directory %r does not exist!' % outdir
- return 1
-
- n = 0
- current = None
- input, output = None, None
-
- for line in open(infile):
- if line.startswith('==== '):
- n += 1
- if input is not None and output is not None:
- input.close()
- output.close()
- if options.strip:
- strip_file(input.name)
- input, output = open_files(outdir, n, line[5:line.find(' ====\n')])
- current = input
- elif line == '====\n':
- current = output
- else:
- current.write(line)
-
- if input is not None and output is not None:
- input.close()
- output.close()
-
- print >>sys.stderr, "%s: %d test cases" % (infile, n)
-
-if __name__ == '__main__':
- sys.exit(main() or 0)
+SUBDIRS = api
EXTRA_DIST = invalid invalid-strip invalid-unicode valid valid-strip
-check_PROGRAMS = test_array test_dump test_load test_simple test_number test_object
+check_PROGRAMS = \
+ test_array \
+ test_dump \
+ test_load \
+ test_simple \
+ test_number \
+ test_object
test_array_SOURCES = test_array.c util.h
test_dump_SOURCES = test_dump.c util.h
AM_CPPFLAGS = -I$(top_srcdir)/src
AM_CFLAGS = -Wall -Werror
LDFLAGS = -static # for speed and Valgrind
-LDADD = ../../src/libjansson.la
+LDADD = $(top_builddir)/src/libjansson.la
--- /dev/null
+#!/bin/sh
+#
+# Copyright (c) 2009 Petri Lehtinen <petri@digip.org>
+#
+# Jansson is free software; you can redistribute it and/or modify
+# it under the terms of the MIT license. See LICENSE for details.
+
+is_test() {
+ test "${test_name%.c}" != "$test_name"
+}
+
+run_test() {
+ $suite_builddir/${test_name%.c} >$test_log/stdout 2>$test_log/stderr
+}
+
+show_error() {
+ valgrind_show_error && return
+ cat $test_log/stderr
+}
+
+. $top_srcdir/test/scripts/run-tests.sh
--- /dev/null
+1
+invalid token near '''
--- /dev/null
+['
\ No newline at end of file
--- /dev/null
+1
+'[' or '{' expected near 'a'
--- /dev/null
+aå
\ No newline at end of file
--- /dev/null
+1
+string or '}' expected near ','
--- /dev/null
+{,
\ No newline at end of file
--- /dev/null
+1
+unexpected token near ','
--- /dev/null
+[,
\ No newline at end of file
--- /dev/null
+1
+']' expected near end of file
--- /dev/null
+[1,
\ No newline at end of file
--- /dev/null
+1
+'[' or '{' expected near end of file
--- /dev/null
+1
+unexpected token near ']'
--- /dev/null
+[1,]
\ No newline at end of file
--- /dev/null
+6
+unexpected token near ']'
--- /dev/null
+[1,
+2,
+3,
+4,
+5,
+]
\ No newline at end of file
--- /dev/null
+2
+end of file expected near 'foo'
--- /dev/null
+[1,2,3]
+foo
--- /dev/null
+1
+end of file expected near 'foo'
--- /dev/null
+[1,2,3]foo
\ No newline at end of file
--- /dev/null
+1
+invalid token near '0'
--- /dev/null
+[012]
\ No newline at end of file
--- /dev/null
+1
+invalid escape near '"\'
--- /dev/null
+["\a <-- invalid escape"]
\ No newline at end of file
--- /dev/null
+1
+invalid token near 'troo'
--- /dev/null
+[troo
\ No newline at end of file
--- /dev/null
+1
+']' expected near 'foo'
--- /dev/null
+[-123foo]
\ No newline at end of file
--- /dev/null
+1
+']' expected near 'foo'
--- /dev/null
+[-123.123foo]
\ No newline at end of file
--- /dev/null
+1
+invalid Unicode '\uD888\u3210'
--- /dev/null
+["\uD888\u3210 (first surrogate and invalid second surrogate)"]
\ No newline at end of file
--- /dev/null
+1
+string or '}' expected near end of file
--- /dev/null
+{
\ No newline at end of file
--- /dev/null
+1
+']' expected near end of file
--- /dev/null
+[
\ No newline at end of file
--- /dev/null
+1
+invalid Unicode '\uDFAA'
--- /dev/null
+["\uDFAA (second surrogate on it's own)"]
\ No newline at end of file
--- /dev/null
+1
+invalid token near '-'
--- /dev/null
+[-foo]
\ No newline at end of file
--- /dev/null
+1
+invalid token near '-0'
--- /dev/null
+[-012]
\ No newline at end of file
--- /dev/null
+1
+\u0000 is not allowed
--- /dev/null
+["\u0000 (null byte not allowed)"]
\ No newline at end of file
--- /dev/null
+1
+'[' or '{' expected near 'null'
--- /dev/null
+null
\ No newline at end of file
--- /dev/null
+1
+string or '}' expected near '''
--- /dev/null
+{'a'
\ No newline at end of file
--- /dev/null
+1
+'}' expected near '123'
--- /dev/null
+{"a":"a" 123}
\ No newline at end of file
--- /dev/null
+1
+']' expected near end of file
--- /dev/null
+[{}
\ No newline at end of file
--- /dev/null
+1
+':' expected near end of file
--- /dev/null
+{"a"
\ No newline at end of file
--- /dev/null
+1
+unexpected token near end of file
--- /dev/null
+{"a":
\ No newline at end of file
--- /dev/null
+1
+premature end of input near '"a'
--- /dev/null
+{"a":"a
\ No newline at end of file
--- /dev/null
+1
+invalid token near '1e'
--- /dev/null
+[1ea]
\ No newline at end of file
--- /dev/null
+1
+real number overflow near '-123123e100000'
--- /dev/null
+[-123123e100000]
\ No newline at end of file
--- /dev/null
+1
+real number overflow near '123123e100000'
--- /dev/null
+[123123e100000]
\ No newline at end of file
--- /dev/null
+1
+invalid token near '1e'
--- /dev/null
+[1e]
\ No newline at end of file
--- /dev/null
+1
+invalid token near '1.'
--- /dev/null
+[1.]
\ No newline at end of file
--- /dev/null
+1
+real number underflow near '123e-10000000'
--- /dev/null
+[123e-10000000]
\ No newline at end of file
--- /dev/null
+#!/bin/sh
+#
+# Copyright (c) 2009 Petri Lehtinen <petri@digip.org>
+#
+# Jansson is free software; you can redistribute it and/or modify
+# it under the terms of the MIT license. See LICENSE for details.
+
+is_test() {
+ test -d $test_path
+}
+
+run_test() {
+ $json_process <$test_path/input >$test_log/stdout 2>$test_log/stderr
+ valgrind_check $test_log/stderr || return 1
+ cmp -s $test_path/error $test_log/stderr
+}
+
+show_error() {
+ valgrind_show_error && return
+
+ echo "EXPECTED ERROR:"
+ nl -bn $test_path/error
+ echo "ACTUAL ERROR:"
+ nl -bn $test_log/stderr
+}
+
+. $top_srcdir/test/scripts/run-tests.sh
--- /dev/null
+1
+control character 0x9 near '"'
--- /dev/null
+[" <-- tab character"]
\ No newline at end of file
--- /dev/null
+1
+too big negative integer near '-123123123123123'
--- /dev/null
+[-123123123123123]
\ No newline at end of file
--- /dev/null
+1
+too big integer near '123123123123123'
--- /dev/null
+[123123123123123]
\ No newline at end of file
--- /dev/null
+1
+invalid Unicode '\uDADA'
--- /dev/null
+["\uDADA (first surrogate without the second)"]
\ No newline at end of file
--- /dev/null
+1
+'[' or '{' expected near 'å'
--- /dev/null
+å
\ No newline at end of file
--- /dev/null
+1
+string or '}' expected near end of file
--- /dev/null
+[{
\ No newline at end of file
--- /dev/null
+1
+']' expected near end of file
--- /dev/null
+["a"
\ No newline at end of file
--- /dev/null
+1
+premature end of input near '"'
--- /dev/null
+{"
\ No newline at end of file
--- /dev/null
+1
+premature end of input near '"a'
--- /dev/null
+{"a
\ No newline at end of file
--- /dev/null
+1
+string or '}' expected near '['
--- /dev/null
+{[
\ No newline at end of file
--- /dev/null
+1
+premature end of input near '"a'
--- /dev/null
+["a
\ No newline at end of file
--- /dev/null
+-1
+unable to decode byte 0xed at position 2
--- /dev/null
+[" <-- encoded surrogate half"]
--- /dev/null
+-1
+unable to decode byte 0xe5 at position 3
--- /dev/null
+-1
+unable to decode byte 0xe5 at position 1
--- /dev/null
+-1
+unable to decode byte 0xe5 at position 4
--- /dev/null
+-1
+unable to decode byte 0xe5 at position 4
--- /dev/null
+-1
+unable to decode byte 0xe5 at position 4
--- /dev/null
+-1
+unable to decode byte 0xe5 at position 2
--- /dev/null
+-1
+unable to decode byte 0xe5 at position 2
--- /dev/null
+-1
+unable to decode byte 0xe5 at position 3
--- /dev/null
+-1
+unable to decode byte 0xe5 at position 2
--- /dev/null
+["å <-- invalid UTF-8"]
--- /dev/null
+-1
+unable to decode byte 0xe5 at position 0
--- /dev/null
+-1
+unable to decode byte 0x81 at position 2
--- /dev/null
+-1
+unable to decode byte 0xf4 at position 2
--- /dev/null
+-1
+unable to decode byte 0xe0 at position 2
--- /dev/null
+["à\80¢ <-- overlong encoding"]
--- /dev/null
+-1
+unable to decode byte 0xf0 at position 2
--- /dev/null
+["ð\80\80¢ <-- overlong encoding"]
--- /dev/null
+-1
+unable to decode byte 0xc1 at position 2
--- /dev/null
+-1
+unable to decode byte 0xfd at position 2
--- /dev/null
+#!/bin/sh
+#
+# Copyright (c) 2009 Petri Lehtinen <petri@digip.org>
+#
+# Jansson is free software; you can redistribute it and/or modify
+# it under the terms of the MIT license. See LICENSE for details.
+
+is_test() {
+ test -d $test_path
+}
+
+run_test() {
+ $json_process <$test_path/input >$test_log/stdout 2>$test_log/stderr
+ valgrind_check $test_log/stderr || return 1
+ cmp -s $test_path/error $test_log/stderr
+}
+
+show_error() {
+ valgrind_show_error && return
+
+ echo "EXPECTED ERROR:"
+ nl -bn $test_path/error
+ echo "ACTUAL ERROR:"
+ nl -bn $test_log/stderr
+}
+
+. $top_srcdir/test/scripts/run-tests.sh
--- /dev/null
+-1
+unable to decode byte 0xe0 at position 2
--- /dev/null
+["àÿ <-- truncated UTF-8"]
--- /dev/null
+1
+invalid token near '''
--- /dev/null
+1
+'[' or '{' expected near 'a'
--- /dev/null
+1
+string or '}' expected near ','
--- /dev/null
+1
+unexpected token near ','
--- /dev/null
+2
+']' expected near end of file
--- /dev/null
+1
+'[' or '{' expected near end of file
--- /dev/null
+1
+unexpected token near ']'
--- /dev/null
+6
+unexpected token near ']'
--- /dev/null
+[1,
+2,
+3,
+4,
+5,
+]
--- /dev/null
+2
+end of file expected near 'foo'
--- /dev/null
+[1,2,3]
+foo
--- /dev/null
+1
+end of file expected near 'foo'
--- /dev/null
+[1,2,3]foo
--- /dev/null
+1
+invalid token near '0'
--- /dev/null
+1
+invalid escape near '"\'
--- /dev/null
+["\a <-- invalid escape"]
--- /dev/null
+1
+invalid token near 'troo'
--- /dev/null
+1
+']' expected near 'foo'
--- /dev/null
+1
+']' expected near 'foo'
--- /dev/null
+[-123.123foo]
--- /dev/null
+1
+invalid Unicode '\uD888\u3210'
--- /dev/null
+["\uD888\u3210 (first surrogate and invalid second surrogate)"]
--- /dev/null
+2
+string or '}' expected near end of file
--- /dev/null
+2
+']' expected near end of file
--- /dev/null
+1
+invalid Unicode '\uDFAA'
--- /dev/null
+["\uDFAA (second surrogate on it's own)"]
--- /dev/null
+1
+invalid token near '-'
--- /dev/null
+1
+invalid token near '-0'
--- /dev/null
+1
+\u0000 is not allowed
--- /dev/null
+["\u0000 (null byte not allowed)"]
--- /dev/null
+1
+'[' or '{' expected near 'null'
--- /dev/null
+1
+string or '}' expected near '''
--- /dev/null
+1
+'}' expected near '123'
--- /dev/null
+{"a":"a" 123}
--- /dev/null
+2
+']' expected near end of file
--- /dev/null
+2
+':' expected near end of file
--- /dev/null
+2
+unexpected token near end of file
--- /dev/null
+1
+unexpected newline near '"a'
--- /dev/null
+1
+invalid token near '1e'
--- /dev/null
+1
+real number overflow near '-123123e100000'
--- /dev/null
+[-123123e100000]
--- /dev/null
+1
+real number overflow near '123123e100000'
--- /dev/null
+[123123e100000]
--- /dev/null
+1
+invalid token near '1e'
--- /dev/null
+1
+invalid token near '1.'
--- /dev/null
+1
+real number underflow near '123e-10000000'
--- /dev/null
+[123e-10000000]
--- /dev/null
+#!/bin/sh
+#
+# Copyright (c) 2009 Petri Lehtinen <petri@digip.org>
+#
+# Jansson is free software; you can redistribute it and/or modify
+# it under the terms of the MIT license. See LICENSE for details.
+
+is_test() {
+ test -d $test_path
+}
+
+run_test() {
+ $json_process <$test_path/input >$test_log/stdout 2>$test_log/stderr
+ valgrind_check $test_log/stderr || return 1
+ cmp -s $test_path/error $test_log/stderr
+}
+
+show_error() {
+ valgrind_show_error && return
+
+ echo "EXPECTED ERROR:"
+ nl -bn $test_path/error
+ echo "ACTUAL ERROR:"
+ nl -bn $test_log/stderr
+}
+
+. $top_srcdir/test/scripts/run-tests.sh
--- /dev/null
+1
+control character 0x9 near '"'
--- /dev/null
+[" <-- tab character"]
--- /dev/null
+1
+too big negative integer near '-123123123123123'
--- /dev/null
+[-123123123123123]
--- /dev/null
+1
+too big integer near '123123123123123'
--- /dev/null
+[123123123123123]
--- /dev/null
+1
+invalid Unicode '\uDADA'
--- /dev/null
+["\uDADA (first surrogate without the second)"]
--- /dev/null
+1
+'[' or '{' expected near 'å'
--- /dev/null
+2
+string or '}' expected near end of file
--- /dev/null
+2
+']' expected near end of file
--- /dev/null
+1
+unexpected newline near '"'
--- /dev/null
+1
+unexpected newline near '"a'
--- /dev/null
+1
+string or '}' expected near '['
--- /dev/null
+1
+unexpected newline near '"a'
--- /dev/null
+[1,2,3,4,
+"a", "b", "c",
+{"foo": "bar", "core": "dump"},
+true, false, true, true, null, false
+]
\ No newline at end of file
--- /dev/null
+[1, 2, 3, 4, "a", "b", "c", {"foo": "bar", "core": "dump"}, true, false, true, true, null, false]
\ No newline at end of file
--- /dev/null
+[]
\ No newline at end of file
--- /dev/null
+[]
\ No newline at end of file
--- /dev/null
+[{}]
\ No newline at end of file
--- /dev/null
+[{}]
\ No newline at end of file
--- /dev/null
+{}
\ No newline at end of file
--- /dev/null
+{}
\ No newline at end of file
--- /dev/null
+[""]
\ No newline at end of file
--- /dev/null
+[""]
\ No newline at end of file
--- /dev/null
+["\u0012 escaped control character"]
\ No newline at end of file
--- /dev/null
+["\u0012 escaped control character"]
\ No newline at end of file
--- /dev/null
+[false]
\ No newline at end of file
--- /dev/null
+[false]
\ No newline at end of file
--- /dev/null
+[-123]
\ No newline at end of file
--- /dev/null
+[-123]
\ No newline at end of file
--- /dev/null
+[-1]
\ No newline at end of file
--- /dev/null
+[-1]
\ No newline at end of file
--- /dev/null
+[-0]
\ No newline at end of file
--- /dev/null
+[0]
\ No newline at end of file
--- /dev/null
+[null]
\ No newline at end of file
--- /dev/null
+[null]
\ No newline at end of file
--- /dev/null
+["\u002c one-byte UTF-8"]
\ No newline at end of file
--- /dev/null
+[", one-byte UTF-8"]
\ No newline at end of file
--- /dev/null
+[1E-2]
\ No newline at end of file
--- /dev/null
+[0.01000000000000000]
\ No newline at end of file
--- /dev/null
+[1E+2]
\ No newline at end of file
--- /dev/null
+[100.00000000000000000]
\ No newline at end of file
--- /dev/null
+[1E22]
\ No newline at end of file
--- /dev/null
+[10000000000000000000000.00000000000000000]
\ No newline at end of file
--- /dev/null
+[123e45]
\ No newline at end of file
--- /dev/null
+[122999999999999994846185700645503654167417192448.00000000000000000]
\ No newline at end of file
--- /dev/null
+[123.456e78]
\ No newline at end of file
--- /dev/null
+[123456000000000003773544074641513176432063851726237026847343602712484748520849408.00000000000000000]
\ No newline at end of file
--- /dev/null
+[1e-2]
\ No newline at end of file
--- /dev/null
+[0.01000000000000000]
\ No newline at end of file
--- /dev/null
+[1e+2]
\ No newline at end of file
--- /dev/null
+[100.00000000000000000]
\ No newline at end of file
--- /dev/null
+#!/bin/sh
+#
+# Copyright (c) 2009 Petri Lehtinen <petri@digip.org>
+#
+# Jansson is free software; you can redistribute it and/or modify
+# it under the terms of the MIT license. See LICENSE for details.
+
+is_test() {
+ test -d $test_path
+}
+
+run_test() {
+ $json_process <$test_path/input >$test_log/stdout 2>$test_log/stderr
+ valgrind_check $test_log/stderr || return 1
+ cmp -s $test_path/output $test_log/stdout
+}
+
+show_error() {
+ valgrind_show_error && return
+
+ echo "EXPECTED OUTPUT:"
+ nl -bn $test_path/output
+ echo "ACTUAL OUTPUT:"
+ nl -bn $test_log/stdout
+}
+
+. $top_srcdir/test/scripts/run-tests.sh
--- /dev/null
+["a"]
\ No newline at end of file
--- /dev/null
+["a"]
\ No newline at end of file
--- /dev/null
+["abcdefghijklmnopqrstuvwxyz1234567890 "]
\ No newline at end of file
--- /dev/null
+["abcdefghijklmnopqrstuvwxyz1234567890 "]
\ No newline at end of file
--- /dev/null
+[0]
\ No newline at end of file
--- /dev/null
+[0]
\ No newline at end of file
--- /dev/null
+[1]
\ No newline at end of file
--- /dev/null
+[1]
\ No newline at end of file
--- /dev/null
+[123]
\ No newline at end of file
--- /dev/null
+[123]
\ No newline at end of file
--- /dev/null
+{"a": []}
\ No newline at end of file
--- /dev/null
+[123.456789]
\ No newline at end of file
--- /dev/null
+[123.45678900000000056]
\ No newline at end of file
--- /dev/null
+["\"\\\/\b\f\n\r\t"]
\ No newline at end of file
--- /dev/null
+["\"\\/\b\f\n\r\t"]
\ No newline at end of file
--- /dev/null
+["\u0821 three-byte UTF-8"]
\ No newline at end of file
--- /dev/null
+["ࠡ three-byte UTF-8"]
\ No newline at end of file
--- /dev/null
+[true]
\ No newline at end of file
--- /dev/null
+[true]
\ No newline at end of file
--- /dev/null
+["\u0123 two-byte UTF-8"]
\ No newline at end of file
--- /dev/null
+["ģ two-byte UTF-8"]
\ No newline at end of file
--- /dev/null
+["€þıœəßð some utf-8 ĸʒ×ŋµåäö𝄞"]
\ No newline at end of file
--- /dev/null
+["€þıœəßð some utf-8 ĸʒ×ŋµåäö𝄞"]
\ No newline at end of file
--- /dev/null
+["\uD834\uDD1E surrogate, four-byte UTF-8"]
\ No newline at end of file
--- /dev/null
+["𝄞 surrogate, four-byte UTF-8"]
\ No newline at end of file
--- /dev/null
+[1,2,3,4,
+"a", "b", "c",
+{"foo": "bar", "core": "dump"},
+true, false, true, true, null, false
+]
--- /dev/null
+[1, 2, 3, 4, "a", "b", "c", {"foo": "bar", "core": "dump"}, true, false, true, true, null, false]
\ No newline at end of file
--- /dev/null
+[]
\ No newline at end of file
--- /dev/null
+[{}]
\ No newline at end of file
--- /dev/null
+{}
\ No newline at end of file
--- /dev/null
+[""]
\ No newline at end of file
--- /dev/null
+["\u0012 escaped control character"]
--- /dev/null
+["\u0012 escaped control character"]
\ No newline at end of file
--- /dev/null
+[false]
\ No newline at end of file
--- /dev/null
+[-123]
\ No newline at end of file
--- /dev/null
+[-1]
\ No newline at end of file
--- /dev/null
+[0]
\ No newline at end of file
--- /dev/null
+[null]
\ No newline at end of file
--- /dev/null
+["\u002c one-byte UTF-8"]
--- /dev/null
+[", one-byte UTF-8"]
\ No newline at end of file
--- /dev/null
+[0.01000000000000000]
\ No newline at end of file
--- /dev/null
+[100.00000000000000000]
\ No newline at end of file
--- /dev/null
+[10000000000000000000000.00000000000000000]
\ No newline at end of file
--- /dev/null
+[122999999999999994846185700645503654167417192448.00000000000000000]
\ No newline at end of file
--- /dev/null
+[123.456e78]
--- /dev/null
+[123456000000000003773544074641513176432063851726237026847343602712484748520849408.00000000000000000]
\ No newline at end of file
--- /dev/null
+[0.01000000000000000]
\ No newline at end of file
--- /dev/null
+[100.00000000000000000]
\ No newline at end of file
--- /dev/null
+#!/bin/sh
+#
+# Copyright (c) 2009 Petri Lehtinen <petri@digip.org>
+#
+# Jansson is free software; you can redistribute it and/or modify
+# it under the terms of the MIT license. See LICENSE for details.
+
+is_test() {
+ test -d $test_path
+}
+
+run_test() {
+ $json_process <$test_path/input >$test_log/stdout 2>$test_log/stderr
+ valgrind_check $test_log/stderr || return 1
+ cmp -s $test_path/output $test_log/stdout
+}
+
+show_error() {
+ valgrind_show_error && return
+
+ echo "EXPECTED OUTPUT:"
+ nl -bn $test_path/output
+ echo "ACTUAL OUTPUT:"
+ nl -bn $test_log/stdout
+}
+
+. $top_srcdir/test/scripts/run-tests.sh
--- /dev/null
+["a"]
\ No newline at end of file
--- /dev/null
+["abcdefghijklmnopqrstuvwxyz1234567890 "]
--- /dev/null
+["abcdefghijklmnopqrstuvwxyz1234567890 "]
\ No newline at end of file
--- /dev/null
+[0]
\ No newline at end of file
--- /dev/null
+[1]
\ No newline at end of file
--- /dev/null
+[123]
\ No newline at end of file
--- /dev/null
+{"a": []}
\ No newline at end of file
--- /dev/null
+[123.456789]
--- /dev/null
+[123.45678900000000056]
\ No newline at end of file
--- /dev/null
+["\"\\\/\b\f\n\r\t"]
--- /dev/null
+["\"\\/\b\f\n\r\t"]
\ No newline at end of file
--- /dev/null
+["\u0821 three-byte UTF-8"]
--- /dev/null
+["ࠡ three-byte UTF-8"]
\ No newline at end of file
--- /dev/null
+[true]
\ No newline at end of file
--- /dev/null
+["\u0123 two-byte UTF-8"]
--- /dev/null
+["ģ two-byte UTF-8"]
\ No newline at end of file
--- /dev/null
+["€þıœəßð some utf-8 ĸʒ×ŋµåäö𝄞"]
--- /dev/null
+["€þıœəßð some utf-8 ĸʒ×ŋµåäö𝄞"]
\ No newline at end of file
--- /dev/null
+["\uD834\uDD1E surrogate, four-byte UTF-8"]
--- /dev/null
+["𝄞 surrogate, four-byte UTF-8"]
\ No newline at end of file
+++ /dev/null
-#!/bin/sh
-#
-# Copyright (c) 2009 Petri Lehtinen <petri@digip.org>
-#
-# Jansson is free software; you can redistribute it and/or modify
-# it under the terms of the MIT license. See LICENSE for details.
-
-VALGRIND_CMDLINE="valgrind --leak-check=full --show-reachable=yes --track-origins=yes -q"
-LOGDIR="testlogs/api"
-N=`find testprogs -type f -executable | wc -l`
-
-echo "testprogs: $N tests"
-
-rm -rf $LOGDIR
-mkdir -p $LOGDIR
-
-if [ -n "$VALGRIND" ]; then
- runner="$VALGRIND_CMDLINE "
-fi
-
-i=1
-failed=
-for prog in testprogs/*; do
- [ -x $prog ] || continue
- t=`basename $prog`
- logbase="testlogs/api/`printf '%02d-%s' $i $t`"
- if ! $runner./$prog >$logbase.stdout 2>$logbase.stderr; then
- echo >&2
- echo "### $prog failed:" >&2
- cat $logbase.stderr
- exit 1
- fi
- if [ -n "$VALGRIND" ]; then
- # Check for Valgrind error output. The valgrind option
- # --error-exitcode is not enough because Valgrind doesn't
- # think unfreed allocs are errors.
- if grep -E -q '^==[0-9]+== ' $logbase.stderr; then
- echo "### $prog failed:" >&2
- echo "valgrind detected an error" >&2
- echo "for details, see test/$logbase.stderr" >&2
- exit 1
- fi
- fi
- echo -n '.'
-done
-echo
+++ /dev/null
-#!/bin/sh
-#
-# Copyright (c) 2009 Petri Lehtinen <petri@digip.org>
-#
-# Jansson is free software; you can redistribute it and/or modify
-# it under the terms of the MIT license. See LICENSE for details.
-
-TESTFILES="${srcdir}/testdata/invalid ${srcdir}/testdata/invalid-strip ${srcdir}/testdata/invalid-unicode"
-
-run_test() {
- local prog=$1
- local prefix=$2
-
- run_testprog $prog $prefix
- if ! cmp $prefix.out $prefix.$prog.stderr >/dev/null; then
- echo >&2
- echo "### $prefix ($prog) failed:" >&2
- cat $prefix.in >&2
- echo "### expected output:" >&2
- cat $prefix.out >&2
- echo "### actual output:" >&2
- cat $prefix.$prog.stderr >&2
- exit 1
- fi
-}
-
-. ${srcdir}/run-test
+++ /dev/null
-#!/bin/sh
-#
-# Copyright (c) 2009 Petri Lehtinen <petri@digip.org>
-#
-# Jansson is free software; you can redistribute it and/or modify
-# it under the terms of the MIT license. See LICENSE for details.
-
-TESTFILES="${srcdir}/testdata/valid ${srcdir}/testdata/valid-strip"
-
-run_test() {
- local prog=$1
- local prefix=$2
-
- run_testprog $prog $prefix
-
- if ! ${srcdir}/json-compare.py $prefix.in $prefix.$prog.stdout \
- >$prefix.$prog.cmp-stdout
- then
- echo >&2
- echo "### $prefix ($prog) failed:" >&2
- cat $prefix.in >&2
- if [ -f $prefix.$prog.stdout ]; then
- echo "### output:" >&2
- cat $prefix.$prog.stdout >&2
- fi
- if [ -s $prefix.$prog.stdout ]; then
- echo "### compare output:" >&2
- cat $prefix.$prog.cmp-stdout >&2
- fi
- exit 1
- fi
-}
-
-. ${srcdir}/run-test
+++ /dev/null
-==== empty ====
-====
-1
-'[' or '{' expected near end of file
-==== null ====
-null
-====
-1
-'[' or '{' expected near 'null'
-==== lone-open-brace ====
-{
-====
-2
-string or '}' expected near end of file
-==== lone-open-bracket ====
-[
-====
-2
-']' expected near end of file
-==== bracket-comma ====
-[,
-====
-1
-unexpected token near ','
-==== bracket-one-comma ====
-[1,
-====
-2
-']' expected near end of file
-==== unterminated-string ====
-["a
-====
-1
-unexpected newline near '"a'
-==== unterminated-array ====
-["a"
-====
-2
-']' expected near end of file
-==== apostrophe ====
-['
-====
-1
-invalid token near '''
-==== brace-comma ====
-{,
-====
-1
-string or '}' expected near ','
-==== unterminated-empty-key ====
-{"
-====
-1
-unexpected newline near '"'
-==== unterminated-key ====
-{"a
-====
-1
-unexpected newline near '"a'
-==== object-no-colon ====
-{"a"
-====
-2
-':' expected near end of file
-==== object-apostrophes ====
-{'a'
-====
-1
-string or '}' expected near '''
-==== object-no-value ====
-{"a":
-====
-2
-unexpected token near end of file
-==== object-unterminated-value ====
-{"a":"a
-====
-1
-unexpected newline near '"a'
-==== object-garbage-at-end ====
-{"a":"a" 123}
-====
-1
-'}' expected near '123'
-==== unterminated-object-and-array ====
-{[
-====
-1
-string or '}' expected near '['
-==== unterminated-array-and-object ====
-[{
-====
-2
-string or '}' expected near end of file
-==== object-in-unterminated-array ====
-[{}
-====
-2
-']' expected near end of file
-==== extra-comma-in-array ====
-[1,]
-====
-1
-unexpected token near ']'
-==== extra-command-in-multiline-array ====
-[1,
-2,
-3,
-4,
-5,
-]
-====
-6
-unexpected token near ']'
-==== real-truncated-at-point ====
-[1.]
-====
-1
-invalid token near '1.'
-==== real-truncated-at-e ====
-[1e]
-====
-1
-invalid token near '1e'
-==== real-garbage-after-e ====
-[1ea]
-====
-1
-invalid token near '1e'
-==== real-positive-overflow ====
-[123123e100000]
-====
-1
-real number overflow near '123123e100000'
-==== real-negative-overflow ====
-[-123123e100000]
-====
-1
-real number overflow near '-123123e100000'
-==== real-underflow ====
-[123e-10000000]
-====
-1
-real number underflow near '123e-10000000'
-==== integer-starting-with-zero ====
-[012]
-====
-1
-invalid token near '0'
-==== negative-integer-starting-with-zero ====
-[-012]
-====
-1
-invalid token near '-0'
-==== too-big-positive-integer ====
-[123123123123123]
-====
-1
-too big integer near '123123123123123'
-==== too-big-negative-integer ====
-[-123123123123123]
-====
-1
-too big negative integer near '-123123123123123'
-==== invalid-identifier ====
-[troo
-====
-1
-invalid token near 'troo'
-==== minus-sign-without-number ====
-[-foo]
-====
-1
-invalid token near '-'
-==== invalid-negative-integerr ====
-[-123foo]
-====
-1
-']' expected near 'foo'
-==== invalid-negative-real ====
-[-123.123foo]
-====
-1
-']' expected near 'foo'
-==== invalid-escape ====
-["\a <-- invalid escape"]
-====
-1
-invalid escape near '"\'
-==== tab-character-in-string ====
-[" <-- tab character"]
-====
-1
-control character 0x9 near '"'
-==== null-byte-in-string ====
-["\u0000 (null byte not allowed)"]
-====
-1
-\u0000 is not allowed
-==== truncated-unicode-surrogate ====
-["\uDADA (first surrogate without the second)"]
-====
-1
-invalid Unicode '\uDADA'
-==== invalid-second-surrogate ====
-["\uD888\u3210 (first surrogate and invalid second surrogate)"]
-====
-1
-invalid Unicode '\uD888\u3210'
-==== lone-second-surrogate ====
-["\uDFAA (second surrogate on it's own)"]
-====
-1
-invalid Unicode '\uDFAA'
-==== unicode-identifier ====
-å
-====
-1
-'[' or '{' expected near 'å'
-==== ascii-unicode-identifier ====
-aå
-====
-1
-'[' or '{' expected near 'a'
-==== garbage-at-the-end ====
-[1,2,3]foo
-====
-1
-end of file expected near 'foo'
-==== garbage-after-newline ====
-[1,2,3]
-foo
-====
-2
-end of file expected near 'foo'
+++ /dev/null
-==== empty ====
-====
-1
-'[' or '{' expected near end of file
-==== null ====
-null
-====
-1
-'[' or '{' expected near 'null'
-==== lone-open-brace ====
-{
-====
-1
-string or '}' expected near end of file
-==== lone-open-bracket ====
-[
-====
-1
-']' expected near end of file
-==== bracket-comma ====
-[,
-====
-1
-unexpected token near ','
-==== bracket-one-comma ====
-[1,
-====
-1
-']' expected near end of file
-==== unterminated-string ====
-["a
-====
-1
-premature end of input near '"a'
-==== unterminated-array ====
-["a"
-====
-1
-']' expected near end of file
-==== apostrophe ====
-['
-====
-1
-invalid token near '''
-==== brace-comma ====
-{,
-====
-1
-string or '}' expected near ','
-==== unterminated-empty-key ====
-{"
-====
-1
-premature end of input near '"'
-==== unterminated-key ====
-{"a
-====
-1
-premature end of input near '"a'
-==== object-no-colon ====
-{"a"
-====
-1
-':' expected near end of file
-==== object-apostrophes ====
-{'a'
-====
-1
-string or '}' expected near '''
-==== object-no-value ====
-{"a":
-====
-1
-unexpected token near end of file
-==== object-unterminated-value ====
-{"a":"a
-====
-1
-premature end of input near '"a'
-==== object-garbage-at-end ====
-{"a":"a" 123}
-====
-1
-'}' expected near '123'
-==== unterminated-object-and-array ====
-{[
-====
-1
-string or '}' expected near '['
-==== unterminated-array-and-object ====
-[{
-====
-1
-string or '}' expected near end of file
-==== object-in-unterminated-array ====
-[{}
-====
-1
-']' expected near end of file
-==== extra-comma-in-array ====
-[1,]
-====
-1
-unexpected token near ']'
-==== extra-command-in-multiline-array ====
-[1,
-2,
-3,
-4,
-5,
-]
-====
-6
-unexpected token near ']'
-==== real-truncated-at-point ====
-[1.]
-====
-1
-invalid token near '1.'
-==== real-truncated-at-e ====
-[1e]
-====
-1
-invalid token near '1e'
-==== real-garbage-after-e ====
-[1ea]
-====
-1
-invalid token near '1e'
-==== real-positive-overflow ====
-[123123e100000]
-====
-1
-real number overflow near '123123e100000'
-==== real-negative-overflow ====
-[-123123e100000]
-====
-1
-real number overflow near '-123123e100000'
-==== real-underflow ====
-[123e-10000000]
-====
-1
-real number underflow near '123e-10000000'
-==== integer-starting-with-zero ====
-[012]
-====
-1
-invalid token near '0'
-==== negative-integer-starting-with-zero ====
-[-012]
-====
-1
-invalid token near '-0'
-==== too-big-positive-integer ====
-[123123123123123]
-====
-1
-too big integer near '123123123123123'
-==== too-big-negative-integer ====
-[-123123123123123]
-====
-1
-too big negative integer near '-123123123123123'
-==== invalid-identifier ====
-[troo
-====
-1
-invalid token near 'troo'
-==== minus-sign-without-number ====
-[-foo]
-====
-1
-invalid token near '-'
-==== invalid-negative-integerr ====
-[-123foo]
-====
-1
-']' expected near 'foo'
-==== invalid-negative-real ====
-[-123.123foo]
-====
-1
-']' expected near 'foo'
-==== invalid-escape ====
-["\a <-- invalid escape"]
-====
-1
-invalid escape near '"\'
-==== tab-character-in-string ====
-[" <-- tab character"]
-====
-1
-control character 0x9 near '"'
-==== null-byte-in-string ====
-["\u0000 (null byte not allowed)"]
-====
-1
-\u0000 is not allowed
-==== truncated-unicode-surrogate ====
-["\uDADA (first surrogate without the second)"]
-====
-1
-invalid Unicode '\uDADA'
-==== invalid-second-surrogate ====
-["\uD888\u3210 (first surrogate and invalid second surrogate)"]
-====
-1
-invalid Unicode '\uD888\u3210'
-==== lone-second-surrogate ====
-["\uDFAA (second surrogate on it's own)"]
-====
-1
-invalid Unicode '\uDFAA'
-==== unicode-identifier ====
-å
-====
-1
-'[' or '{' expected near 'å'
-==== ascii-unicode-identifier ====
-aå
-====
-1
-'[' or '{' expected near 'a'
-==== garbage-at-the-end ====
-[1,2,3]foo
-====
-1
-end of file expected near 'foo'
-==== garbage-after-newline ====
-[1,2,3]
-foo
-====
-2
-end of file expected near 'foo'
+++ /dev/null
-==== lone-invalid-utf-8 ====
-å
-====
--1
-unable to decode byte 0xe5 at position 0
-==== invalid-utf-8-in-string ====
-["å <-- invalid UTF-8"]
-====
--1
-unable to decode byte 0xe5 at position 2
-==== invalid-utf-8-in-array ====
-[å]
-====
--1
-unable to decode byte 0xe5 at position 1
-==== invalid-utf-8-in-identifier ====
-[aå]
-====
--1
-unable to decode byte 0xe5 at position 2
-==== invalid-utf-8-in-escape ====
-["\uå"]
-====
--1
-unable to decode byte 0xe5 at position 4
-==== invalid-utf-8-after-backslash ====
-["\å"]
-====
--1
-unable to decode byte 0xe5 at position 3
-==== invalid-utf-8-in-int ====
-[0å]
-====
--1
-unable to decode byte 0xe5 at position 2
-==== invalid-utf-8-in-bigger-int ====
-[123å]
-====
--1
-unable to decode byte 0xe5 at position 4
-==== invalid-utf-8-in-real-after-e ====
-[1eå]
-====
--1
-unable to decode byte 0xe5 at position 3
-==== invalid-utf-8-in-exponent ====
-[1e1å]
-====
--1
-unable to decode byte 0xe5 at position 4
-==== lone-utf-8-continuation-byte ====
-["\81"]
-====
--1
-unable to decode byte 0x81 at position 2
-==== overlong-ascii-encoding ====
-["Á"]
-====
--1
-unable to decode byte 0xc1 at position 2
-==== restricted-utf-8 ====
-["ý"]
-====
--1
-unable to decode byte 0xfd at position 2
-==== not-in-unicode-range ====
-[""]
-====
--1
-unable to decode byte 0xf4 at position 2
-==== overlong-3-byte-encoding ====
-["à\80¢ <-- overlong encoding"]
-====
--1
-unable to decode byte 0xe0 at position 2
-==== overlong-4-byte-encoding ====
-["ð\80\80¢ <-- overlong encoding"]
-====
--1
-unable to decode byte 0xf0 at position 2
-==== truncated-utf-8 ====
-["àÿ <-- truncated UTF-8"]
-====
--1
-unable to decode byte 0xe0 at position 2
-==== encoded-surrogate-half ====
-[" <-- encoded surrogate half"]
-====
--1
-unable to decode byte 0xed at position 2
+++ /dev/null
-==== empty-string ====
-[""]
-==== short-string ====
-["a"]
-==== simple-ascii-string ====
-["abcdefghijklmnopqrstuvwxyz1234567890 "]
-==== utf-8-string ====
-["€þıœəßð some utf-8 ĸʒ×ŋµåäö𝄞"]
-==== string-escapes ====
-["\"\\\/\b\f\n\r\t"]
-==== one-byte-utf-8 ====
-["\u002c one-byte UTF-8"]
-==== two-byte-utf-8 ====
-["\u0123 two-byte UTF-8"]
-==== three-byte-utf-8 ====
-["\u0821 three-byte UTF-8"]
-==== utf-surrogate-four-byte-encoding ====
-["\uD834\uDD1E surrogate, four-byte UTF-8"]
-==== escaped-utf-control-char ====
-["\u0012 escaped control character"]
-==== simple-int-0 ====
-[0]
-==== simple-int-1 ====
-[1]
-==== simple-int-123 ====
-[123]
-==== negative-zero ====
-[-0]
-==== negative-one ====
-[-1]
-==== negative-int ====
-[-123]
-==== simple-real ====
-[123.456789]
-==== real-exponent ====
-[123e45]
-==== real-capital-e ====
-[1E22]
-==== real-positive-exponent ====
-[1e+2]
-==== real-negative-exponent ====
-[1e-2]
-==== real-capital-e-positive-exponent ====
-[1E+2]
-==== real-capital-e-negative-exponent ====
-[1E-2]
-==== real-fraction-exponent ====
-[123.456e78]
-==== true ====
-[true]
-==== false ====
-[false]
-==== null ====
-[null]
-==== empty-array ====
-[]
-==== empty-object-in-array ====
-[{}]
-==== complex-array ====
-[1,2,3,4,
-"a", "b", "c",
-{"foo": "bar", "core": "dump"},
-true, false, true, true, null, false
-]
-==== empty-object ====
-{}
-==== simple-object ====
-{"a":[]}
+++ /dev/null
-==== empty-string ====
-[""]
-==== short-string ====
-["a"]
-==== simple-ascii-string ====
-["abcdefghijklmnopqrstuvwxyz1234567890 "]
-==== utf-8-string ====
-["€þıœəßð some utf-8 ĸʒ×ŋµåäö𝄞"]
-==== string-escapes ====
-["\"\\\/\b\f\n\r\t"]
-==== one-byte-utf-8 ====
-["\u002c one-byte UTF-8"]
-==== two-byte-utf-8 ====
-["\u0123 two-byte UTF-8"]
-==== three-byte-utf-8 ====
-["\u0821 three-byte UTF-8"]
-==== utf-surrogate-four-byte-encoding ====
-["\uD834\uDD1E surrogate, four-byte UTF-8"]
-==== escaped-utf-control-char ====
-["\u0012 escaped control character"]
-==== simple-int-0 ====
-[0]
-==== simple-int-1 ====
-[1]
-==== simple-int-123 ====
-[123]
-==== negative-zero ====
-[-0]
-==== negative-one ====
-[-1]
-==== negative-int ====
-[-123]
-==== simple-real ====
-[123.456789]
-==== real-exponent ====
-[123e45]
-==== real-capital-e ====
-[1E22]
-==== real-positive-exponent ====
-[1e+2]
-==== real-negative-exponent ====
-[1e-2]
-==== real-capital-e-positive-exponent ====
-[1E+2]
-==== real-capital-e-negative-exponent ====
-[1E-2]
-==== real-fraction-exponent ====
-[123.456e78]
-==== true ====
-[true]
-==== false ====
-[false]
-==== null ====
-[null]
-==== empty-array ====
-[]
-==== empty-object-in-array ====
-[{}]
-==== complex-array ====
-[1,2,3,4,
-"a", "b", "c",
-{"foo": "bar", "core": "dump"},
-true, false, true, true, null, false
-]
-==== empty-object ====
-{}
-==== simple-object ====
-{"a":[]}