mirror of
https://github.com/json-c/json-c.git
synced 2026-09-07 08:36:50 +08:00
Add tests for the json_parse cli tool.
This commit is contained in:
@@ -38,6 +38,10 @@ set(ALL_TEST_NAMES
|
||||
test_visit
|
||||
test_object_iterator)
|
||||
|
||||
set(NOBUILD_TEST_NAMES
|
||||
test_json_parse_cli
|
||||
)
|
||||
|
||||
if (NOT DISABLE_JSON_POINTER)
|
||||
set(ALL_TEST_NAMES ${ALL_TEST_NAMES} test_json_pointer)
|
||||
set(ALL_TEST_NAMES ${ALL_TEST_NAMES} test_safe_json_pointer_set)
|
||||
@@ -46,6 +50,10 @@ if (NOT DISABLE_JSON_POINTER)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
foreach(TESTNAME ${NOBUILD_TEST_NAMES})
|
||||
add_test(NAME ${TESTNAME} COMMAND ${PROJECT_SOURCE_DIR}/tests/${TESTNAME}.test)
|
||||
endforeach(TESTNAME)
|
||||
|
||||
foreach(TESTNAME ${ALL_TEST_NAMES})
|
||||
|
||||
add_executable(${TESTNAME} ${TESTNAME}.c)
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
Successfully parsed object from stdin
|
||||
Failed at offset 71: invalid utf-8 string: char=0x00
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
#!/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
|
||||
|
||||
echo -n '"tenant=blue;note=CANARY_STACK_WINDOW_2026;status=ok"' > file1.dat
|
||||
(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=$?
|
||||
|
||||
exit $_err
|
||||
Reference in New Issue
Block a user