30 BOOST_REQUIRE_NO_THROW(
Options(
"Test") );
38 TFile::Open(
"input.root",
"RECREATE")->Close();
40 fs::path
input, output;
41 BOOST_REQUIRE_NO_THROW(
options.input(
"input", &
input,
"input ROOT file") );
42 BOOST_REQUIRE_NO_THROW(
options.output(
"output", &output,
"output ROOT file") );
44 BOOST_TEST_MESSAGE(
"testing unknown commands" );
46 auto const args =
tokenize(
"exec input.root output.root --unknown");
47 BOOST_REQUIRE_THROW(
options(
args.size(),
args.data()), boost::wrapexcept<po::error> );
50 BOOST_TEST_MESSAGE(
"testing normal commands" );
52 auto const args =
tokenize(
"exec input.root output.root");
56 cout <<
options.full_cmd << endl;
60 fs::remove(
"output.root");
62 BOOST_TEST_MESSAGE(
"testing bad input" );
64 auto const args =
tokenize(
"exec inpu.root output.root");
65 BOOST_REQUIRE_THROW(
options(
args.size(),
args.data()), boost::wrapexcept<fs::filesystem_error> );
68 BOOST_TEST_MESSAGE(
"testing bad output" );
71 BOOST_REQUIRE_THROW(
options(
args.size(),
args.data()), boost::wrapexcept<fs::filesystem_error> );
74 BOOST_TEST_MESSAGE(
"testing non-readable input" );
76 fs::permissions(
"input.root", fs::perms::owner_read, fs::perm_options::remove);
77 auto const args =
tokenize(
"exec input.root output.root");
78 BOOST_REQUIRE_THROW(
options(
args.size(),
args.data()), boost::wrapexcept<fs::filesystem_error> );
79 fs::permissions(
"input.root", fs::perms::owner_read, fs::perm_options::add);
82 TFile::Open(
"output.root",
"RECREATE")->Close();
84 BOOST_TEST_MESSAGE(
"testing non-writable output" );
86 fs::permissions(
"output.root", fs::perms::owner_write, fs::perm_options::remove);
87 auto const args =
tokenize(
"exec input.root output.root");
88 BOOST_REQUIRE_THROW(
options(
args.size(),
args.data()), boost::wrapexcept<fs::filesystem_error> );
89 fs::permissions(
"output.root", fs::perms::owner_write, fs::perm_options::add);
92 fs::remove(
"input.root");
93 fs::remove(
"output.root");