Skip to content

Commit

Permalink
updated as per make all.update_from_clone
Browse files Browse the repository at this point in the history
  • Loading branch information
lcn2 committed Jan 4, 2025
1 parent 830c805 commit 6032ee7
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 88 deletions.
17 changes: 0 additions & 17 deletions jparse/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,5 @@
# Significant changes in the JSON parser repo

## Release 2.2.1 2025-01-02

Disable 2 invalid JSON encode/decode string tests in `jstr_test.sh`.


## Release 2.2.0 2025-01-01

Bug fixes to do with exit codes in `test_jparse/jparse_test.sh`. Some functions
being passed invalid data did not exit but rather change the exit code which
could then be changed by a function that runs later. Also in the case that a
test passed, in one location, it would change the exit code back to 0, thus
changing the result of a failed test back to not failing, giving a false result.
As the exit code starts at 0 now if any test fails it'll never be a 0 exit code
(though if an internal error occurs later the exit code won't indicate a test
failed, if there was one).


## Release 2.1.10 2024-12-31

Improve invalid JSON token error message (`yyerror()`)
Expand Down
75 changes: 47 additions & 28 deletions jparse/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -830,8 +830,7 @@ rebuild_jparse_err_files: jparse
${S} echo "${OUR_NAME}: make $@ starting"
${S} echo
${Q} ${RM} ${RM_V} -f test_jparse/test_JSON/bad_loc/*.err
-${Q} for i in test_jparse/test_JSON/./bad_loc/*.json; do \
echo './jparse -v 0 - "'$$i'" 2> "'$$i'.err"'; \
-@for i in test_jparse/test_JSON/./bad_loc/*.json; do \
./jparse -v 0 -- "$$i" 2> "$$i.err" ; \
done
${S} echo
Expand Down Expand Up @@ -1263,29 +1262,49 @@ depend: ${ALL_CSRC}
${S} echo "${OUR_NAME}: make $@ ending"

### DO NOT CHANGE MANUALLY BEYOND THIS LINE
jparse.o: jparse.c jparse.h jparse.tab.h json_parse.h json_sem.h \
json_utf8.h json_util.h util.h
jparse.ref.o: jparse.h jparse.ref.c jparse.tab.h json_parse.h json_sem.h \
json_utf8.h json_util.h util.h
jparse.tab.o: jparse.h jparse.lex.h jparse.tab.c jparse.tab.h json_parse.h \
json_sem.h json_utf8.h json_util.h util.h version.h
jparse.tab.ref.o: jparse.h jparse.lex.h jparse.tab.h jparse.tab.ref.c \
json_parse.h json_sem.h json_utf8.h json_util.h util.h version.h
jparse_main.o: jparse.h jparse.tab.h jparse_main.c jparse_main.h \
json_parse.h json_sem.h json_utf8.h json_util.h util.h version.h
jsemtblgen.o: jparse.h jparse.tab.h jsemtblgen.c jsemtblgen.h json_parse.h \
json_sem.h json_utf8.h json_util.h util.h version.h
json_parse.o: jparse.h jparse.tab.h json_parse.c json_parse.h json_sem.h \
json_utf8.h json_util.h util.h
json_sem.o: jparse.h jparse.tab.h json_parse.h json_sem.c json_sem.h \
json_utf8.h json_util.h util.h
json_util.o: jparse.h jparse.tab.h json_parse.h json_sem.h json_utf8.h \
json_util.c json_util.h util.h
jstr_util.o: jparse.h jparse.tab.h json_parse.h json_sem.h json_utf8.h \
json_util.h jstr_util.c jstr_util.h util.h
jstrdecode.o: jparse.h jparse.tab.h json_parse.h json_sem.h json_utf8.h \
json_util.h jstr_util.h jstrdecode.c jstrdecode.h util.h version.h
jstrencode.o: jparse.h jparse.tab.h json_parse.h json_sem.h json_utf8.h \
json_util.h jstr_util.h jstrencode.c jstrencode.h util.h version.h
util.o: util.c util.h
verge.o: json_utf8.h util.h verge.c verge.h version.h
jparse.o: ../dbg/dbg.h ../dyn_array/../dbg/dbg.h ../dyn_array/dyn_array.h \
jparse.c jparse.h jparse.tab.h json_parse.h json_sem.h json_utf8.h \
json_util.h util.h
jparse.ref.o: ../dbg/dbg.h ../dyn_array/../dbg/dbg.h \
../dyn_array/dyn_array.h jparse.h jparse.ref.c jparse.tab.h \
json_parse.h json_sem.h json_utf8.h json_util.h util.h
jparse.tab.o: ../dbg/dbg.h ../dyn_array/../dbg/dbg.h \
../dyn_array/dyn_array.h jparse.h jparse.lex.h jparse.tab.c \
jparse.tab.h json_parse.h json_sem.h json_utf8.h json_util.h util.h \
version.h
jparse.tab.ref.o: ../dbg/dbg.h ../dyn_array/../dbg/dbg.h \
../dyn_array/dyn_array.h jparse.h jparse.lex.h jparse.tab.h \
jparse.tab.ref.c json_parse.h json_sem.h json_utf8.h json_util.h util.h \
version.h
jparse_main.o: ../dbg/dbg.h ../dyn_array/../dbg/dbg.h \
../dyn_array/dyn_array.h jparse.h jparse.tab.h jparse_main.c \
jparse_main.h json_parse.h json_sem.h json_utf8.h json_util.h util.h \
version.h
jsemtblgen.o: ../dbg/dbg.h ../dyn_array/../dbg/dbg.h \
../dyn_array/dyn_array.h jparse.h jparse.tab.h jsemtblgen.c \
jsemtblgen.h json_parse.h json_sem.h json_utf8.h json_util.h util.h \
version.h
json_parse.o: ../dbg/dbg.h ../dyn_array/../dbg/dbg.h \
../dyn_array/dyn_array.h jparse.h jparse.tab.h json_parse.c \
json_parse.h json_sem.h json_utf8.h json_util.h util.h
json_sem.o: ../dbg/dbg.h ../dyn_array/../dbg/dbg.h ../dyn_array/dyn_array.h \
jparse.h jparse.tab.h json_parse.h json_sem.c json_sem.h json_utf8.h \
json_util.h util.h
json_util.o: ../dbg/dbg.h ../dyn_array/../dbg/dbg.h \
../dyn_array/dyn_array.h jparse.h jparse.tab.h json_parse.h json_sem.h \
json_utf8.h json_util.c json_util.h util.h
jstr_util.o: ../dbg/dbg.h ../dyn_array/../dbg/dbg.h \
../dyn_array/dyn_array.h jparse.h jparse.tab.h json_parse.h json_sem.h \
json_utf8.h json_util.h jstr_util.c jstr_util.h util.h
jstrdecode.o: ../dbg/dbg.h ../dyn_array/../dbg/dbg.h \
../dyn_array/dyn_array.h jparse.h jparse.tab.h json_parse.h json_sem.h \
json_utf8.h json_util.h jstr_util.h jstrdecode.c jstrdecode.h util.h \
version.h
jstrencode.o: ../dbg/dbg.h ../dyn_array/../dbg/dbg.h \
../dyn_array/dyn_array.h jparse.h jparse.tab.h json_parse.h json_sem.h \
json_utf8.h json_util.h jstr_util.h jstrencode.c jstrencode.h util.h \
version.h
util.o: ../dbg/dbg.h ../dyn_array/../dbg/dbg.h ../dyn_array/dyn_array.h \
util.c util.h
verge.o: ../dbg/dbg.h ../dyn_array/../dbg/dbg.h ../dyn_array/dyn_array.h \
json_utf8.h util.h verge.c verge.h version.h
13 changes: 8 additions & 5 deletions jparse/test_jparse/jparse_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@

# setup
#
export JPARSE_TEST_VERSION="1.2.3 2025-01-01" # version format: major.minor YYYY-MM-DD */
export JPARSE_TEST_VERSION="1.2.2 2024-10-13" # version format: major.minor YYYY-MM-DD */
export CHK_TEST_FILE="./test_jparse/json_teststr.txt"
export CHK_INVALID_TEST_FILE="./test_jparse/json_teststr_fail.txt"
export JPARSE="./jparse"
Expand Down Expand Up @@ -535,7 +535,7 @@ run_location_err_test()
fi

echo | tee -a -- "${LOGFILE}" 1>&2
EXIT_CODE=1
EXIT_CODE=50
elif [[ "$V_FLAG" -ge 1 ]]; then
echo "$0: debug[1]: fail test OK, $JPARSE -- $jparse_test_file matches error file" | tee -a -- "$LOGFILE"
fi
Expand Down Expand Up @@ -575,7 +575,8 @@ run_file_test()

if [[ "$pass_fail" != "pass" && "$pass_fail" != "fail" ]]; then
echo "$0: ERROR: in run_file_test: pass_fail neither 'pass' nor 'fail'" 1>&2
exit 10
EXIT_CODE=11
return
fi

# debugging
Expand Down Expand Up @@ -707,7 +708,7 @@ run_print_test()
else
echo "$0: in test that must pass: print_test FAIL, exit code: $status" 1>&2 >> "${LOGFILE}"
PRINT_TEST_FAILURE="1"
EXIT_CODE=1
EXIT_CODE=2
fi
echo >> "${LOGFILE}"

Expand Down Expand Up @@ -747,7 +748,8 @@ run_string_test()

if [[ "$pass_fail" != "pass" && "$pass_fail" != "fail" ]]; then
echo "$0: ERROR: in run_string_test: pass_fail neither 'pass' nor 'fail'" 1>&2
exit 12
EXIT_CODE=11
return
fi

# debugging
Expand Down Expand Up @@ -803,6 +805,7 @@ run_string_test()
if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: in run_string_test: jparse exit code: $status" 1>&2 >> "${LOGFILE}"
fi
EXIT_CODE=0
fi
fi
echo >> "${LOGFILE}"
Expand Down
68 changes: 31 additions & 37 deletions jparse/test_jparse/jstr_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export JSTRENCODE="./jstrencode"
export TEST_FILE="./test_jparse/jstr_test.out"
export TEST_FILE2="./test_jparse/jstr_test2.out"
export JSTR_TEST_TXT="./test_jparse/jstr_test.txt"
export JSTR_TEST_VERSION="1.2.7 2025-01-02" # version format: major.minor YYYY-MM-DD
export JSTR_TEST_VERSION="1.2.5 2024-12-26" # version format: major.minor YYYY-MM-DD
export TOPDIR=

export USAGE="usage: $0 [-h] [-V] [-v level] [-e jstrencode] [-d jstrdecode] [-Z topdir]
Expand Down Expand Up @@ -184,43 +184,37 @@ else
EXIT_CODE=4
fi

###################################################################################
# NOTE: We disable these 2 tests as per https://github.com/xexyl/jparse/issues/32 #
# with perhaps restoring them to some extent when this issue is resolved: #
# https://github.com/xexyl/jparse/issues/31 #
###################################################################################

# disabled ## test JSON decoding and encoding pipe
# disabled #echo "$0: about to run test #1"
# disabled #echo "$JSTRENCODE -v $V_FLAG -n < $JSTRENCODE | $JSTRDECODE -v $V_FLAG -n > $TEST_FILE"
# disabled ## This warning is not correct in our case:
# disabled ##
# disabled ## SC2094 (info): Make sure not to read and write the same file in the same pipeline.
# disabled ## https://www.shellcheck.net/wiki/SC2094
# disabled ## shellcheck disable=SC2094
# disabled #"$JSTRENCODE" -v "$V_FLAG" -n < "$JSTRENCODE" | $JSTRDECODE -v "$V_FLAG" -n > "$TEST_FILE"
# disabled #if cmp -s "$JSTRENCODE" "$TEST_FILE"; then
# disabled # echo "$0: test #1 passed" 1>&2
# disabled #else
# disabled # echo "$0: test #1 failed" 1>&2
# disabled # EXIT_CODE=4
# disabled #fi
# test JSON decoding and encoding pipe
echo "$0: about to run test #1"
echo "$JSTRENCODE -v $V_FLAG -n < $JSTRENCODE | $JSTRDECODE -v $V_FLAG -n > $TEST_FILE"
# This warning is not correct in our case:
#
# SC2094 (info): Make sure not to read and write the same file in the same pipeline.
# https://www.shellcheck.net/wiki/SC2094
# shellcheck disable=SC2094
"$JSTRENCODE" -v "$V_FLAG" -n < "$JSTRENCODE" | $JSTRDECODE -v "$V_FLAG" -n > "$TEST_FILE"
if cmp -s "$JSTRENCODE" "$TEST_FILE"; then
echo "$0: test #1 passed" 1>&2
else
echo "$0: test #1 failed" 1>&2
EXIT_CODE=4
fi

# disabled #echo "$0: about to run test #2"
# disabled #echo "$JSTRENCODE -v $V_FLAG -n < $JSTRDECODE | $JSTRDECODE -v $V_FLAG -n > $TEST_FILE"
# disabled ## This warning is incorrect in our case:
# disabled ##
# disabled ## SC2094 (info): Make sure not to read and write the same file in the same pipeline.
# disabled ## https://www.shellcheck.net/wiki/SC2094
# disabled ## shellcheck disable=SC2094
# disabled ##
# disabled #"$JSTRENCODE" -v "$V_FLAG" -n < "$JSTRDECODE" | "$JSTRDECODE" -v "$V_FLAG" -n > "$TEST_FILE"
# disabled #if cmp -s "$JSTRDECODE" "$TEST_FILE"; then
# disabled # echo "$0: test #2 passed"
# disabled #else
# disabled # echo "$0: test #2 failed" 1>&2
# disabled # EXIT_CODE=4
# disabled #fi
echo "$0: about to run test #2"
echo "$JSTRENCODE -v $V_FLAG -n < $JSTRDECODE | $JSTRDECODE -v $V_FLAG -n > $TEST_FILE"
# This warning is incorrect in our case:
#
# SC2094 (info): Make sure not to read and write the same file in the same pipeline.
# https://www.shellcheck.net/wiki/SC2094
# shellcheck disable=SC2094
#
"$JSTRENCODE" -v "$V_FLAG" -n < "$JSTRDECODE" | "$JSTRDECODE" -v "$V_FLAG" -n > "$TEST_FILE"
if cmp -s "$JSTRDECODE" "$TEST_FILE"; then
echo "$0: test #2 passed"
else
echo "$0: test #2 failed" 1>&2
EXIT_CODE=4
fi

# test some text holes in the decoding and encoding pipe
#
Expand Down
2 changes: 1 addition & 1 deletion jparse/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*
* NOTE: this should match the latest Release string in CHANGES.md
*/
#define JPARSE_REPO_VERSION "2.2.1 2025-01-02" /* format: major.minor YYYY-MM-DD */
#define JPARSE_REPO_VERSION "2.1.10 2024-12-31" /* format: major.minor YYYY-MM-DD */

/*
* official jparse version
Expand Down

0 comments on commit 6032ee7

Please sign in to comment.