summaryrefslogtreecommitdiff
path: root/tests/test.hpp
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2015-04-12 03:05:58 -0700
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2015-04-12 03:05:58 -0700
commita19da1c246f244da57197915df3ab70f24bf1502 (patch)
tree08522294870adb468c37042365095ebbae2c0177 /tests/test.hpp
parente90d2ac8ba44fbcf4d5702643f708f2c86bde42e (diff)
parenta0d065cd22d1d43c417f6d3db88a04bf57b67ed0 (diff)
Merge branch 'master' into compact
Diffstat (limited to 'tests/test.hpp')
-rw-r--r--tests/test.hpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/test.hpp b/tests/test.hpp
index 4222638..46c3330 100644
--- a/tests/test.hpp
+++ b/tests/test.hpp
@@ -142,6 +142,12 @@ struct dummy_fixture {};
#define CHECK_XPATH_FAIL(query) CHECK_XPATH_FAIL_VAR(query, 0)
#endif
+#ifdef PUGIXML_NO_EXCEPTIONS
+#define CHECK_ALLOC_FAIL(code) CHECK(!test_runner::_memory_fail_triggered); code; CHECK(test_runner::_memory_fail_triggered); test_runner::_memory_fail_triggered = false
+#else
+#define CHECK_ALLOC_FAIL(code) CHECK(!test_runner::_memory_fail_triggered); try { code; } catch (std::bad_alloc&) {} CHECK(test_runner::_memory_fail_triggered); test_runner::_memory_fail_triggered = false
+#endif
+
#define STR(text) PUGIXML_TEXT(text)
#ifdef __DMC__