From a12216dd1ed9582fc96805189caadc2b733a4e70 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 2 Feb 2018 15:08:09 +0200 Subject: Adjust tests to new test rule semantics --- tests/manifest-roundtrip/buildfile | 2 +- tests/manifest-roundtrip/driver.cxx | 52 ++++++++++++++++--------------------- 2 files changed, 24 insertions(+), 30 deletions(-) (limited to 'tests/manifest-roundtrip') diff --git a/tests/manifest-roundtrip/buildfile b/tests/manifest-roundtrip/buildfile index 19678d8..7b55569 100644 --- a/tests/manifest-roundtrip/buildfile +++ b/tests/manifest-roundtrip/buildfile @@ -6,4 +6,4 @@ import libs = libbutl%lib{butl} libs += $stdmod_lib exe{driver}: {hxx cxx}{*} $libs -exe{driver}: test.roundtrip = manifest +exe{driver}: file{manifest}: test.roundtrip = true 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] << " " << 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; } -- cgit v1.1