From 17da5ba554426d732fc850e7211bae7d3a7c016e Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Tue, 25 Jan 2022 01:47:59 +0100 Subject: test: Add additional JSON test case --- test/Makefile.am | 1 + test/data/j2.plist | 1 + test/json2.test | 11 ++++------- test/json3.test | 22 ++++++++++++++++++++++ 4 files changed, 28 insertions(+), 7 deletions(-) create mode 100644 test/data/j2.plist create mode 100755 test/json3.test (limited to 'test') diff --git a/test/Makefile.am b/test/Makefile.am index b70a85d..a75644a 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -52,6 +52,7 @@ TESTS = \ uid.test \ json1.test \ json2.test \ + json3.test \ json-invalid-types.test EXTRA_DIST = \ diff --git a/test/data/j2.plist b/test/data/j2.plist new file mode 100644 index 0000000..9d1210e --- /dev/null +++ b/test/data/j2.plist @@ -0,0 +1 @@ +{"Some ASCII string":"Test ASCII String","Some UTF8 strings":["àéèçù","日本語","汉语/漢語","한국어/조선말","русский язык","الْعَرَبيّة","עִבְרִית","język polski","हिन्दी"],"Keys & \"entities\"":"hellow world & others are \"fun!?'","Boolean":false,"Another Boolean":true,"Some Int":32434543632,"Some String with Unicode entity":"Yeah check this: \u1234 !!!"} \ No newline at end of file diff --git a/test/json2.test b/test/json2.test index 06a7007..1329016 100755 --- a/test/json2.test +++ b/test/json2.test @@ -4,7 +4,7 @@ set -e DATASRC=$top_srcdir/test/data DATAOUT=$top_builddir/test/data -TESTFILE=entities.plist +TESTFILE=j2.plist if ! test -d "$DATAOUT"; then mkdir -p $DATAOUT @@ -12,11 +12,8 @@ fi export PLIST_JSON_DEBUG=1 -echo "Converting input file to JSON" -$top_builddir/tools/plistutil -f json -i $DATASRC/$TESTFILE -o $DATASRC/$TESTFILE.json - -echo "Converting to binary and back to JSON" -$top_builddir/test/plist_jtest $DATASRC/$TESTFILE.json $DATAOUT/$TESTFILE.json.out +echo "Converting" +$top_builddir/test/plist_jtest $DATASRC/$TESTFILE $DATAOUT/$TESTFILE.out echo "Comparing" -$top_builddir/test/plist_cmp $DATASRC/$TESTFILE $DATAOUT/$TESTFILE.json.out +$top_builddir/test/plist_cmp $DATASRC/$TESTFILE $DATAOUT/$TESTFILE.out diff --git a/test/json3.test b/test/json3.test new file mode 100755 index 0000000..06a7007 --- /dev/null +++ b/test/json3.test @@ -0,0 +1,22 @@ +## -*- sh -*- + +set -e + +DATASRC=$top_srcdir/test/data +DATAOUT=$top_builddir/test/data +TESTFILE=entities.plist + +if ! test -d "$DATAOUT"; then + mkdir -p $DATAOUT +fi + +export PLIST_JSON_DEBUG=1 + +echo "Converting input file to JSON" +$top_builddir/tools/plistutil -f json -i $DATASRC/$TESTFILE -o $DATASRC/$TESTFILE.json + +echo "Converting to binary and back to JSON" +$top_builddir/test/plist_jtest $DATASRC/$TESTFILE.json $DATAOUT/$TESTFILE.json.out + +echo "Comparing" +$top_builddir/test/plist_cmp $DATASRC/$TESTFILE $DATAOUT/$TESTFILE.json.out -- cgit v1.1-32-gdbae