I modified one of the answers here like
std::string path_to_exectuable = "thepath";
TEST(FooTester,CheckHelpScriptReturns0)
{
using bp =::boost::process;
std::vector<std::string> args; args.push_back("--help");
bp::context ctx;
ctx.stdout_behavior = bp::capture_stream();
bp::child c = bp::launch(exec, args, ctx);
EXPECT_EXIT(c.terminate(), ::testing::ExitedWithCode(0), "");
}
in the hope to make it more straightforward. However, this wont work,and will output
Result: failed to die
So, is this approach possible at all, and if yes, what is missing?
Aucun commentaire:
Enregistrer un commentaire