aboutsummaryrefslogtreecommitdiff
path: root/tests/manifest-roundtrip/driver.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-02-02 15:08:09 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-02-02 15:08:09 +0200
commita12216dd1ed9582fc96805189caadc2b733a4e70 (patch)
treec6ca5e69690d0c1fbc4520d8e40ff0cec44a78d0 /tests/manifest-roundtrip/driver.cxx
parentcc87d5c452d42356d80fb98ac30c729ada26d2b0 (diff)
Adjust tests to new test rule semantics
Diffstat (limited to 'tests/manifest-roundtrip/driver.cxx')
-rw-r--r--tests/manifest-roundtrip/driver.cxx52
1 files changed, 23 insertions, 29 deletions
diff --git a/tests/manifest-roundtrip/driver.cxx b/tests/manifest-roundtrip/driver.cxx
index 1f0b311..654763e 100644
--- a/tests/manifest-roundtrip/driver.cxx
+++ b/tests/manifest-roundtrip/driver.cxx
@@ -31,40 +31,34 @@ using namespace std;
using namespace butl;
int
-main (int argc, char* argv[])
+main ()
+try
{
- if (argc != 2)
- {
- cerr << "usage: " << argv[0] << " <file>" << endl;
- return 1;
- }
+ // Read/write in binary mode.
+ //
+ stdin_fdmode (fdstream_mode::binary);
+ stdout_fdmode (fdstream_mode::binary);
- try
- {
- ifdstream ifs (argv[1]);
- manifest_parser p (ifs, argv[1]);
+ manifest_parser p (cin, "stdin");
+ manifest_serializer s (cout, "stdout");
- stdout_fdmode (fdstream_mode::binary); // Write in binary mode.
- manifest_serializer s (cout, "stdout");
+ for (bool eom (true), eos (false); !eos; )
+ {
+ manifest_name_value nv (p.next ());
- for (bool eom (true), eos (false); !eos; )
+ if (nv.empty ()) // End pair.
{
- manifest_name_value nv (p.next ());
-
- if (nv.empty ()) // End pair.
- {
- eos = eom;
- eom = true;
- }
- else
- eom = false;
-
- s.next (nv.name, nv.value);
+ eos = eom;
+ eom = true;
}
+ else
+ eom = false;
+
+ s.next (nv.name, nv.value);
}
- catch (const exception& e)
- {
- cerr << e << endl;
- return 1;
- }
+}
+catch (const exception& e)
+{
+ cerr << e << endl;
+ return 1;
}