jansson/test/test-invalid
Petri Lehtinen 04d550b02e Add stripped unit tests for decoder
That is, test cases where there's no newline or other whitespace at
the beginning or end of input. This was implemented by adding a
--strip option to split-testfile to strip the input file after writing
it.

The actual test JSON texts are the same as testdata/invalid and
testdata/valid. The expected output of the invalid cases had to be
adjusted a bit: because there's no newline at the end, some of the
line numbers needed to be changed.
2009-09-08 17:03:01 +03:00

28 lines
735 B
Bash
Executable File

#!/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