mirror of
https://github.com/microsoft/GSL.git
synced 2024-11-03 17:56:43 -05:00
add throw on nullptr CTOR test (#577)
This commit is contained in:
parent
3a12c55cb6
commit
ac91ac1408
@ -134,6 +134,11 @@ TEST_CASE("TestNotNullConstructors")
|
|||||||
|
|
||||||
not_null<std::shared_ptr<int>> x(
|
not_null<std::shared_ptr<int>> x(
|
||||||
std::make_shared<int>(10)); // shared_ptr<int> is nullptr assignable
|
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>
|
template<typename T>
|
||||||
|
Loading…
Reference in New Issue
Block a user