From 2d15efda5db161accd5f572fd4816885bce7c68c Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 23 Jun 2022 22:55:20 +0300 Subject: Split and merge manifest value/comment pair differently depending on whether it is multiline or not --- tests/manifest-roundtrip/driver.cxx | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests/manifest-roundtrip/driver.cxx') 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); } } -- cgit v1.1