aboutsummaryrefslogtreecommitdiff
path: root/tests/manifest-roundtrip
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manifest-roundtrip')
-rw-r--r--tests/manifest-roundtrip/driver.cxx13
-rw-r--r--tests/manifest-roundtrip/testscript40
2 files changed, 53 insertions, 0 deletions
diff --git a/tests/manifest-roundtrip/driver.cxx b/tests/manifest-roundtrip/driver.cxx
index 5dc5862..c63a729 100644
--- a/tests/manifest-roundtrip/driver.cxx
+++ b/tests/manifest-roundtrip/driver.cxx
@@ -22,11 +22,16 @@ using namespace butl;
// -m
// Serialize multi-line manifest values using the v2 form.
//
+// -s
+// Split values into the value/comment pairs and merge them back before
+// printing.
+//
int
main (int argc, const char* argv[])
try
{
bool multiline_v2 (false);
+ bool split (false);
for (int i (1); i != argc; ++i)
{
@@ -34,6 +39,8 @@ try
if (v == "-m")
multiline_v2 = true;
+ else if (v == "-s")
+ split = true;
}
// Read/write in binary mode.
@@ -61,6 +68,12 @@ try
else
eom = false;
+ if (split)
+ {
+ const auto& vc (manifest_parser::split_comment (nv.value));
+ nv.value = manifest_serializer::merge_comment (vc.first, vc.second);
+ }
+
s.next (nv.name, nv.value);
}
}
diff --git a/tests/manifest-roundtrip/testscript b/tests/manifest-roundtrip/testscript
index e0a15cc..a228b0f 100644
--- a/tests/manifest-roundtrip/testscript
+++ b/tests/manifest-roundtrip/testscript
@@ -76,3 +76,43 @@ $* -m <<EOF >>EOF
c:\windows\\
\
EOF
+
+: split-merge-comment
+:
+$* -s <<EOF >>EOF
+ : 1
+ info:\
+ value
+ text
+ \
+ info:\
+ value
+ text
+ ;
+ comment
+ \
+ info:\
+ ;
+ comment
+ text
+ \
+ info:\
+ value
+ \;
+ \\
+ ;
+ comment
+ \
+ info:\
+ value
+ \\;
+ ;
+ comment
+ \
+ info:\
+ value
+ \\\\;
+ ;
+ comment
+ \
+ EOF