2026-06-21 13:44:59 -04:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
|
|
# Common definitions
|
|
|
|
|
if test -z "$srcdir"; then
|
|
|
|
|
srcdir="${0%/*}"
|
|
|
|
|
test "$srcdir" = "$0" && srcdir=.
|
|
|
|
|
test -z "$srcdir" && srcdir=.
|
|
|
|
|
fi
|
|
|
|
|
. "$srcdir/test-defs.sh"
|
|
|
|
|
|
|
|
|
|
set -x -v
|
|
|
|
|
|
2026-08-20 23:21:16 +02:00
|
|
|
printf '%s' '"tenant=blue;note=CANARY_STACK_WINDOW_2026;status=ok"' > file1.dat
|
2026-06-21 13:44:59 -04:00
|
|
|
(printf '"' ; printf 'A%.0s' $(seq 1 16) ; echo 'e2' | xxd -r -p) > file2.dat
|
|
|
|
|
|
|
|
|
|
TESTNAME="${0##*/}"
|
|
|
|
|
TESTNAME="${TESTNAME%.test}"
|
|
|
|
|
( cat file1.dat ; cat file2.dat ) | run_output_test -o "${TESTNAME}" --exit 1 ../apps/json_parse -u -N -n -
|
|
|
|
|
_err=$?
|
|
|
|
|
|
2026-09-08 10:57:26 +08:00
|
|
|
printf '{' | "${top_builddir}/../apps/json_parse" -N -n - > /dev/null 2>&1
|
|
|
|
|
if test $? -eq 0; then
|
|
|
|
|
echo "ERROR: json_parse accepted incomplete input" 1>&2
|
|
|
|
|
_err=1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
printf '123' | "${top_builddir}/../apps/json_parse" -N -n - > /dev/null 2>&1
|
|
|
|
|
if test $? -ne 0; then
|
|
|
|
|
echo "ERROR: json_parse rejected valid EOF-terminated scalar input" 1>&2
|
|
|
|
|
_err=1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
"${top_builddir}/../apps/json_parse" -N -n - <&- > /dev/null 2>&1
|
|
|
|
|
if test $? -eq 0; then
|
|
|
|
|
echo "ERROR: json_parse returned success after read failure" 1>&2
|
|
|
|
|
_err=1
|
|
|
|
|
fi
|
|
|
|
|
|
2026-06-21 13:44:59 -04:00
|
|
|
exit $_err
|