summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2017-01-02 02:08:02 +0100
committerGravatar Nikias Bassen2017-01-02 02:08:02 +0100
commit9f03f8aabcd036c1a97d9cfb6330409127202102 (patch)
treecf69ad328cee5bf9f8b381219a1d2be55d7b5824
parent552801556f8537bcdeee2cc93e347a35a0847f7f (diff)
downloadlibplist-9f03f8aabcd036c1a97d9cfb6330409127202102.tar.gz
libplist-9f03f8aabcd036c1a97d9cfb6330409127202102.tar.bz2
test: Add new test case for dictionaries with empty keys
-rw-r--r--test/Makefile.am3
-rw-r--r--test/data/empty_keys.plist8
-rwxr-xr-xtest/empty_keys.test12
3 files changed, 22 insertions, 1 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index f100e54..6f43929 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -32,9 +32,10 @@ TESTS = \
order.test \
recursion.test \
entities.test \
+ empty_keys.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/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/malformed_dict.bplist
TESTS_ENVIRONMENT = top_srcdir=$(top_srcdir) top_builddir=$(top_builddir)
diff --git a/test/data/empty_keys.plist b/test/data/empty_keys.plist
new file mode 100644
index 0000000..a0107b4
--- /dev/null
+++ b/test/data/empty_keys.plist
@@ -0,0 +1,8 @@
+<plist version="1.0">
+<dict>
+ <key></key>
+ <string>empty key</string>
+ <key><!-- comment --></key>
+ <string>empty key with comment</string>
+</dict>
+</plist>
diff --git a/test/empty_keys.test b/test/empty_keys.test
new file mode 100755
index 0000000..4291e8c
--- /dev/null
+++ b/test/empty_keys.test
@@ -0,0 +1,12 @@
+## -*- sh -*-
+
+set -e
+
+DATASRC=$top_srcdir/test/data
+TESTFILE=empty_keys.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