aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib/src/tests/exception_classes
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2016-09-20 14:45:50 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2016-09-20 14:45:50 +0000
commitf4787b504e67005bbe8b7b8716b812514c4a5308 (patch)
tree8349b86543420175bcd405d32bb7d70d865acf3a /vespalib/src/tests/exception_classes
parenta0588fd32d8457633b21ac19310727f2cb6fa432 (diff)
Provide the supplied message to the catch place.
Diffstat (limited to 'vespalib/src/tests/exception_classes')
-rw-r--r--vespalib/src/tests/exception_classes/exception_classes_test.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/vespalib/src/tests/exception_classes/exception_classes_test.cpp b/vespalib/src/tests/exception_classes/exception_classes_test.cpp
index f9413970281..946c3fa32e4 100644
--- a/vespalib/src/tests/exception_classes/exception_classes_test.cpp
+++ b/vespalib/src/tests/exception_classes/exception_classes_test.cpp
@@ -33,4 +33,17 @@ TEST("require that PortListenException with cause retains relevant information")
}
}
+TEST("test that OOMException carries message forward.") {
+ const char * M = "This is the simple message.";
+ bool caught(false);
+ try {
+ throw OOMException(M);
+ ASSERT_TRUE(false);
+ } catch (OOMException & e) {
+ EXPECT_EQUAL(0, strcmp(M, e.what()));
+ caught = true;
+ }
+ EXPECT_TRUE(caught);
+}
+
TEST_MAIN() { TEST_RUN_ALL(); }