summaryrefslogtreecommitdiffstats
path: root/deps/jemalloc/test/integration/cpp/infallible_new_false.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'deps/jemalloc/test/integration/cpp/infallible_new_false.cpp')
-rw-r--r--deps/jemalloc/test/integration/cpp/infallible_new_false.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/deps/jemalloc/test/integration/cpp/infallible_new_false.cpp b/deps/jemalloc/test/integration/cpp/infallible_new_false.cpp
new file mode 100644
index 0000000..42196d6
--- /dev/null
+++ b/deps/jemalloc/test/integration/cpp/infallible_new_false.cpp
@@ -0,0 +1,23 @@
+#include <memory>
+
+#include "test/jemalloc_test.h"
+
+TEST_BEGIN(test_failing_alloc) {
+ bool saw_exception = false;
+ try {
+ /* Too big of an allocation to succeed. */
+ void *volatile ptr = ::operator new((size_t)-1);
+ (void)ptr;
+ } catch (...) {
+ saw_exception = true;
+ }
+ expect_true(saw_exception, "Didn't get a failure");
+}
+TEST_END
+
+int
+main(void) {
+ return test(
+ test_failing_alloc);
+}
+