|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r64896 - sandbox/SOC/2010/process/libs/process/test
From: boris_at_[hidden]
Date: 2010-08-18 16:13:35
Author: bschaeling
Date: 2010-08-18 16:13:31 EDT (Wed, 18 Aug 2010)
New Revision: 64896
URL: http://svn.boost.org/trac/boost/changeset/64896
Log:
Added test case test_output_stdout_stderr
Text files modified:
sandbox/SOC/2010/process/libs/process/test/child.cpp | 33 +++++++++++++++++++++++++++++++++
1 files changed, 33 insertions(+), 0 deletions(-)
Modified: sandbox/SOC/2010/process/libs/process/test/child.cpp
==============================================================================
--- sandbox/SOC/2010/process/libs/process/test/child.cpp (original)
+++ sandbox/SOC/2010/process/libs/process/test/child.cpp 2010-08-18 16:13:31 EDT (Wed, 18 Aug 2010)
@@ -203,6 +203,39 @@
#endif
}
+BOOST_AUTO_TEST_CASE(test_output_stdout_stderr)
+{
+ std::vector<std::string> args;
+ args.push_back("echo-stdout-stderr");
+ args.push_back("message-to-two-streams");
+
+ bp::context ctx;
+ ctx.stdout_behavior = bpb::pipe::create(bpb::pipe::output_stream);
+ ctx.stderr_behavior = bpb::pipe::create(bpb::pipe::output_stream);
+
+ bp::child c = bp::create_child(get_helpers_path(), args, ctx);
+
+ std::string word;
+ bp::pistream &isout = c.get_stdout();
+ isout >> word;
+ BOOST_CHECK_EQUAL(word, "stdout");
+ isout >> word;
+ BOOST_CHECK_EQUAL(word, "message-to-two-streams");
+ bp::pistream &iserr = c.get_stderr();
+ iserr >> word;
+ BOOST_CHECK_EQUAL(word, "stderr");
+ iserr >> word;
+ BOOST_CHECK_EQUAL(word, "message-to-two-streams");
+
+ int s = c.wait();
+#if defined(BOOST_POSIX_API)
+ BOOST_REQUIRE(WIFEXITED(s));
+ BOOST_CHECK_EQUAL(WEXITSTATUS(s), EXIT_SUCCESS);
+#elif defined(BOOST_WINDOWS_API)
+ BOOST_CHECK_EQUAL(s, EXIT_SUCCESS);
+#endif
+}
+
class redirect_to : public bpb::stream
{
public:
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk