Initial commit, version 0.1.0.
[libfsafe.git] / tests / Checkpoint.cxx
blobc88d7f2060a17c8fa21a99e2803d8418beda93dd
1 #include <tests/Checkpoint.hxx>
2 #include <libfsafe/checkpoint.hxx>
3 #include <libsex/Exception.hxx>
4 #include <sstream>
6 void tests::Checkpoint::passIfStatementPasses()
8 CHECKPOINT((void) true);
11 void tests::Checkpoint::wrapIfStatementThrows()
13 CHECKPOINT(throw libsex::Exception("Error!"));
16 void tests::Checkpoint::testBacktrace()
18 try {
19 wrapIfStatementThrows();
20 CPPUNIT_FAIL("false positive");
21 } catch (libsex::Exception& e) {
22 std::string exp = __FILE__ ":13: "
23 "In 'throw libsex::Exception(\"Error!\")':\n"
24 "Error!";
25 std::stringstream act;
26 e.backtrace(act);
27 CPPUNIT_ASSERT_EQUAL(exp, act.str());