aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormenete <menete@users.noreply.github.com>2018-02-12 18:31:09 +0100
committerNeil MacIntosh <neilmac@fb.com>2018-02-12 09:31:09 -0800
commitac91ac140824e75ca726a3af8e9129f70de35a6b (patch)
tree92a34f72a7ef89346ac7a77dd16dcda2d6998ae6
parent3a12c55cb63c0a7e46d4bf3f73dcab72eb192adb (diff)
downloadplatform_external_Microsoft-GSL-ac91ac140824e75ca726a3af8e9129f70de35a6b.tar.gz
platform_external_Microsoft-GSL-ac91ac140824e75ca726a3af8e9129f70de35a6b.tar.bz2
platform_external_Microsoft-GSL-ac91ac140824e75ca726a3af8e9129f70de35a6b.zip
add throw on nullptr CTOR test (#577)
-rw-r--r--tests/notnull_tests.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/notnull_tests.cpp b/tests/notnull_tests.cpp
index 50b15f6..4baf7b3 100644
--- a/tests/notnull_tests.cpp
+++ b/tests/notnull_tests.cpp
@@ -134,6 +134,11 @@ TEST_CASE("TestNotNullConstructors")
not_null<std::shared_ptr<int>> x(
std::make_shared<int>(10)); // shared_ptr<int> is nullptr assignable
+
+#ifdef GSL_THROW_ON_CONTRACT_VIOLATION
+ int* pi = nullptr;
+ CHECK_THROWS_AS(not_null<decltype(pi)>(pi), fail_fast);
+#endif
}
template<typename T>