summaryrefslogtreecommitdiffstats
path: root/test/plistutil-streams.test
diff options
context:
space:
mode:
authorGravatar Alberto Maschietto2026-09-08 01:12:20 +0400
committerGravatar Nikias Bassen2026-09-29 17:00:18 +0200
commitfba74cf8bd9696b9b7f42a8cbb9e16dd065b0a83 (patch)
tree89ebb7b5a8ca5dfaa2e0e57887ae846ac147712a /test/plistutil-streams.test
parent2b0754dee5c5b9c4b3d5114359436e7b737a57f4 (diff)
downloadlibplist-fba74cf8bd9696b9b7f42a8cbb9e16dd065b0a83.tar.gz
libplist-fba74cf8bd9696b9b7f42a8cbb9e16dd065b0a83.tar.bz2
plistutil: preserve binary data on Windows standard streams
Diffstat (limited to 'test/plistutil-streams.test')
-rwxr-xr-xtest/plistutil-streams.test34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/plistutil-streams.test b/test/plistutil-streams.test
new file mode 100755
index 0000000..ce3c516
--- /dev/null
+++ b/test/plistutil-streams.test
@@ -0,0 +1,34 @@
+## -*- sh -*-
+set -e
+
+DATASRC=$top_srcdir/test/data
+DATAOUT=$top_builddir/test/data
+PLISTUTIL=$top_builddir/tools/plistutil
+TESTFILE=$DATAOUT/plistutil-streams.test
+
+mkdir -p "$DATAOUT"
+
+# The data contains CR, LF and Ctrl-Z, which Windows text streams translate.
+"$PLISTUTIL" -i "$DATASRC/streams.plist" -f bin -o "$TESTFILE.bin"
+"$PLISTUTIL" -i "$TESTFILE.bin" -f xml -o "$TESTFILE.xml"
+
+echo "Checking binary stdout"
+"$PLISTUTIL" -i "$DATASRC/streams.plist" -f bin > "$TESTFILE.stdout.out"
+cmp "$TESTFILE.bin" "$TESTFILE.stdout.out"
+"$PLISTUTIL" -i "$DATASRC/streams.plist" -f bin -o - > "$TESTFILE.stdout.out"
+cmp "$TESTFILE.bin" "$TESTFILE.stdout.out"
+
+echo "Checking binary stdin"
+"$PLISTUTIL" -f xml -o "$TESTFILE.stdin.out" < "$TESTFILE.bin"
+cmp "$TESTFILE.xml" "$TESTFILE.stdin.out"
+cat "$TESTFILE.bin" | "$PLISTUTIL" -i - -f xml -o "$TESTFILE.stdin.out"
+cmp "$TESTFILE.xml" "$TESTFILE.stdin.out"
+
+echo "Checking binary stdin in print mode"
+"$PLISTUTIL" -p "$TESTFILE.bin" > "$TESTFILE.print.out"
+cat "$TESTFILE.bin" | "$PLISTUTIL" -p - > "$TESTFILE.stdin.out"
+cmp "$TESTFILE.print.out" "$TESTFILE.stdin.out"
+
+echo "Checking XML stdout"
+"$PLISTUTIL" -i "$TESTFILE.bin" -f xml > "$TESTFILE.stdout.out"
+cmp "$TESTFILE.xml" "$TESTFILE.stdout.out"