summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2017-01-02 02:29:35 +0100
committerGravatar Nikias Bassen2017-01-02 02:29:35 +0100
commit9950acbecda1b1bdf567e2e5efae84103c105a2d (patch)
tree40a46b8c0f657ac8f2261930b3c201514eb7cf32
parent9f03f8aabcd036c1a97d9cfb6330409127202102 (diff)
downloadlibplist-9950acbecda1b1bdf567e2e5efae84103c105a2d.tar.gz
libplist-9950acbecda1b1bdf567e2e5efae84103c105a2d.tar.bz2
test: Add some more test cases for various valid and invalid content
-rw-r--r--test/Makefile.am5
-rwxr-xr-xtest/amp.test14
-rwxr-xr-xtest/cdata.test12
-rw-r--r--test/data/amp.plist6
-rw-r--r--test/data/cdata.plist6
-rw-r--r--test/data/invalid_tag.plist6
-rwxr-xr-xtest/invalid_tag.test14
7 files changed, 62 insertions, 1 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index 6f43929..aed3a58 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -33,9 +33,12 @@ TESTS = \
recursion.test \
entities.test \
empty_keys.test \
+ amp.test \
+ invalid_tag.test \
+ cdata.test \
malformed_dict.test
-EXTRA_DIST = $(TESTS) data/1.plist data/2.plist data/3.plist data/4.plist data/5.plist data/6.plist data/7.plist data/signed.plist data/signed.bplist data/unsigned.plist data/unsigned.bplist data/hex.plist data/order.bplist data/recursion.bplist data/entities.plist data/empty_keys.plist data/malformed_dict.bplist
+EXTRA_DIST = $(TESTS) data/1.plist data/2.plist data/3.plist data/4.plist data/5.plist data/6.plist data/7.plist data/signed.plist data/signed.bplist data/unsigned.plist data/unsigned.bplist data/hex.plist data/order.bplist data/recursion.bplist data/entities.plist data/empty_keys.plist data/amp.plist data/invalid_tag.plist data/cdata.test data/malformed_dict.bplist
TESTS_ENVIRONMENT = top_srcdir=$(top_srcdir) top_builddir=$(top_builddir)
diff --git a/test/amp.test b/test/amp.test
new file mode 100755
index 0000000..0815391
--- /dev/null
+++ b/test/amp.test
@@ -0,0 +1,14 @@
+## -*- sh -*-
+
+set -e
+
+DATASRC=$top_srcdir/test/data
+TESTFILE=amp.plist
+DATAIN0=$DATASRC/$TESTFILE
+DATAOUT0=$top_builddir/test/data/$TESTFILE.out
+
+rm -rf $DATAOUT0
+$top_builddir/tools/plistutil -i $DATAIN0 -o $DATAOUT0
+if test -f $DATAOUT0; then
+ exit 1
+fi
diff --git a/test/cdata.test b/test/cdata.test
new file mode 100755
index 0000000..77e7e45
--- /dev/null
+++ b/test/cdata.test
@@ -0,0 +1,12 @@
+## -*- sh -*-
+
+set -e
+
+DATASRC=$top_srcdir/test/data
+TESTFILE=cdata.plist
+DATAIN0=$DATASRC/$TESTFILE
+DATAOUT0=$top_builddir/test/data/$TESTFILE.bin
+
+$top_builddir/tools/plistutil -i $DATAIN0 -o $DATAOUT0
+
+$top_builddir/test/plist_cmp $DATAIN0 $DATAOUT0
diff --git a/test/data/amp.plist b/test/data/amp.plist
new file mode 100644
index 0000000..ce9e7ac
--- /dev/null
+++ b/test/data/amp.plist
@@ -0,0 +1,6 @@
+<plist version="1.0">
+<dict>
+ <key>test&amp</key>
+ <string>value</string>
+</dict>
+</plist>
diff --git a/test/data/cdata.plist b/test/data/cdata.plist
new file mode 100644
index 0000000..dcd015f
--- /dev/null
+++ b/test/data/cdata.plist
@@ -0,0 +1,6 @@
+<plist version="1.0">
+<dict>
+ <key><![CDATA[cdata&key]]></key>
+ <string>string with cdata content: <![CDATA[ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~]]> !!!</string>
+</dict>
+</plist>
diff --git a/test/data/invalid_tag.plist b/test/data/invalid_tag.plist
new file mode 100644
index 0000000..feb770f
--- /dev/null
+++ b/test/data/invalid_tag.plist
@@ -0,0 +1,6 @@
+<plist version="1.0">
+<dict>
+ <key>test<!test></key>
+ <string>value</string>
+</dict>
+</plist>
diff --git a/test/invalid_tag.test b/test/invalid_tag.test
new file mode 100755
index 0000000..079bcdd
--- /dev/null
+++ b/test/invalid_tag.test
@@ -0,0 +1,14 @@
+## -*- sh -*-
+
+set -e
+
+DATASRC=$top_srcdir/test/data
+TESTFILE=invalid_tag.plist
+DATAIN0=$DATASRC/$TESTFILE
+DATAOUT0=$top_builddir/test/data/$TESTFILE.out
+
+rm -rf $DATAOUT0
+$top_builddir/tools/plistutil -i $DATAIN0 -o $DATAOUT0
+if test -f $DATAOUT0; then
+ exit 1
+fi