aboutsummaryrefslogtreecommitdiff
path: root/tests/manifest-serializer
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-07-21 22:15:29 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-07-27 14:30:27 +0300
commit258835fb4cd7338f9a0f9a758860cf1a368987dc (patch)
tree5ce1b92d1efb927c9428bf441d55031191326da3 /tests/manifest-serializer
parentf23282939c77bd1973457569aa3e002fef0559e3 (diff)
Implement manifest parsing/serialization
Diffstat (limited to 'tests/manifest-serializer')
-rw-r--r--tests/manifest-serializer/driver.in2
-rw-r--r--tests/manifest-serializer/testscript108
2 files changed, 85 insertions, 25 deletions
diff --git a/tests/manifest-serializer/driver.in b/tests/manifest-serializer/driver.in
index 9e619e5..4ee31a7 100644
--- a/tests/manifest-serializer/driver.in
+++ b/tests/manifest-serializer/driver.in
@@ -14,7 +14,6 @@ butl_manifest_serializer_start "$@"
fd="$butl_manifest_serializer_ifd"
while read -r n; do
-
printf "%s:" "$n" >&"$fd"
f=true
@@ -31,7 +30,6 @@ while read -r n; do
printf "%s" "$v" >&"$fd"
fi
done
-
done
butl_manifest_serializer_finish
diff --git a/tests/manifest-serializer/testscript b/tests/manifest-serializer/testscript
index af96cc0..f305342 100644
--- a/tests/manifest-serializer/testscript
+++ b/tests/manifest-serializer/testscript
@@ -2,34 +2,96 @@
# copyright : Copyright (c) 2014-2018 Code Synthesis Ltd
# license : MIT; see accompanying LICENSE file
-$* <<EOI >>EOO
+: stdout
+{
+ $* <<EOI >>EOO
-1
+ 1
-name
-foo
+ name
+ foo
-version
-1.2.3
+ version
+ 1.2.3
-description
-foo
-executable
+ description
+ foo
+ executable
-depends
-libfoo
+ depends
+ libfoo
-depends
-libbar
+ depends
+ libbar
-EOI
-: 1
-name: foo
-version: 1.2.3
-description: foo
-executable
-depends: libfoo
-depends: libbar
-EOO
+ EOI
+ : 1
+ name: foo
+ version: 1.2.3
+ description: \
+ foo
+ executable
+ \
+ depends: libfoo
+ depends: libbar
+ EOO
+}
-#@@ TODO: test writing to file instead of stdout.
+: file
+{
+ $* <<EOI >=file;
+
+ 1
+
+ name
+ foo
+
+ version
+ 1.2.3
+ EOI
+
+ cat file >>EOE
+ : 1
+ name: foo
+ version: 1.2.3
+ EOE
+}
+
+: list
+{
+ $* <<EOI >>EOO
+
+ 1
+
+ name
+ foo
+
+
+ 1
+
+ version
+ 1.2.3
+ EOI
+ : 1
+ name: foo
+ :
+ version: 1.2.3
+ EOO
+}
+
+: version
+:
+{
+ : absent
+ :
+ $* <<EOI 2>'stdout: error: format version pair expected' != 0
+ name
+ foo
+ EOI
+}
+
+: empty
+:
+{
+ $* <:'' >:''
+}