exception tests: each exception must be in an own test case

master
Marc Wäckerlin 20 years ago
parent fc0254a342
commit ec1e1f1898
  1. 14
      mrw/exec_test.cpp

@ -9,6 +9,9 @@
@license LGPL, see file <a href="license.html">COPYING</a> @license LGPL, see file <a href="license.html">COPYING</a>
$Log$ $Log$
Revision 1.7 2004/12/20 13:21:21 marc
exception tests: each exception must be in an own test case
Revision 1.6 2004/12/14 20:30:10 marc Revision 1.6 2004/12/14 20:30:10 marc
added possibility to pass string to stdin of child process added possibility to pass string to stdin of child process
@ -47,9 +50,11 @@ public:
std::string res =mrw::Cmd("/bin/cat").execute("This is a test"); std::string res =mrw::Cmd("/bin/cat").execute("This is a test");
CPPUNIT_ASSERT(res=="This is a test"); CPPUNIT_ASSERT(res=="This is a test");
} }
void excTest() { void excTest1() {
std::string res1 = (mrw::Cmd("/bin/false")).execute().result(); std::string res = (mrw::Cmd("/bin/false")).execute().result();
std::string res2 = (mrw::Cmd("/bin/false")).execute("").result(); }
void excTest2() {
std::string res = (mrw::Cmd("/bin/false")).execute("").result();
} }
void unexpectedExc() throw(std::bad_exception) { void unexpectedExc() throw(std::bad_exception) {
std::string res = (mrw::Cmd("/bin/false")).execute().result(); std::string res = (mrw::Cmd("/bin/false")).execute().result();
@ -57,7 +62,8 @@ public:
CPPUNIT_TEST_SUITE(ExecTest); CPPUNIT_TEST_SUITE(ExecTest);
CPPUNIT_TEST(lsTest); CPPUNIT_TEST(lsTest);
CPPUNIT_TEST(catTest); CPPUNIT_TEST(catTest);
CPPUNIT_TEST_EXCEPTION(excTest, mrw::ExecutionFailedExc); CPPUNIT_TEST_EXCEPTION(excTest1, mrw::ExecutionFailedExc);
CPPUNIT_TEST_EXCEPTION(excTest2, mrw::ExecutionFailedExc);
CPPUNIT_TEST_EXCEPTION(unexpectedExc, std::bad_exception); CPPUNIT_TEST_EXCEPTION(unexpectedExc, std::bad_exception);
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
}; };

Loading…
Cancel
Save