diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2018-02-02 15:08:09 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2018-02-02 15:08:09 +0200 |
commit | a12216dd1ed9582fc96805189caadc2b733a4e70 (patch) | |
tree | c6ca5e69690d0c1fbc4520d8e40ff0cec44a78d0 /tests/manifest-roundtrip | |
parent | cc87d5c452d42356d80fb98ac30c729ada26d2b0 (diff) |
Adjust tests to new test rule semantics
Diffstat (limited to 'tests/manifest-roundtrip')
-rw-r--r-- | tests/manifest-roundtrip/buildfile | 2 | ||||
-rw-r--r-- | tests/manifest-roundtrip/driver.cxx | 52 |
2 files changed, 24 insertions, 30 deletions
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] << " <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; } |