From ac91ac140824e75ca726a3af8e9129f70de35a6b Mon Sep 17 00:00:00 2001 From: menete Date: Mon, 12 Feb 2018 18:31:09 +0100 Subject: [PATCH] add throw on nullptr CTOR test (#577) --- tests/notnull_tests.cpp | 5 +++++ 1 file changed, 5 insertions(+) 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> x( std::make_shared(10)); // shared_ptr is nullptr assignable + +#ifdef GSL_THROW_ON_CONTRACT_VIOLATION + int* pi = nullptr; + CHECK_THROWS_AS(not_null(pi), fail_fast); +#endif } template