diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2022-06-23 22:55:20 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2022-06-24 15:58:39 +0300 |
commit | 2d15efda5db161accd5f572fd4816885bce7c68c (patch) | |
tree | 3832d4e33aeb7d91418d07bfe0a824723ff18a37 /tests/manifest-roundtrip | |
parent | 0ae2c768fc8b2e43d271284544af35a27dc2cd17 (diff) |
Split and merge manifest value/comment pair differently depending on whether it is multiline or not
Diffstat (limited to 'tests/manifest-roundtrip')
-rw-r--r-- | tests/manifest-roundtrip/driver.cxx | 13 | ||||
-rw-r--r-- | tests/manifest-roundtrip/testscript | 40 |
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 |