Closed bluetarpmedia closed 8 months ago
assert_not_null now verifies std::unique_ptr, std::shared_ptr, std::optional and std::expected in addition to the original null pointer check.
assert_not_null
std::unique_ptr
std::shared_ptr
std::optional
std::expected
These states are considered to be "null" and will result in a violation error if dereferenced or accessed:
Null violation errors will be reported in the following cases:
test: () = { ex: std::expected<int, bool> = std::unexpected(false); op: std::optional<int> = std::nullopt; up:= unique.new<int>(1); sp:= shared.new<int>(2); up.reset(); sp.reset(); v1 := ex*; // Null violation error v2 := op*; // Null violation error v3 := up*; // Null violation error v4 := sp*; // Null violation error }
Add new regression tests:
Thanks!
The test output isn't platform-independent. See #556:
Update tests that finish through std::terminate. Add std::set_terminate(std::abort); to avoid platform-dependent output on termination.
std::terminate
std::set_terminate(std::abort);
assert_not_null
now verifiesstd::unique_ptr
,std::shared_ptr
,std::optional
andstd::expected
in addition to the original null pointer check.These states are considered to be "null" and will result in a violation error if dereferenced or accessed:
std::unique_ptr
that owns nothingstd::shared_ptr
with no managed objectstd::optional
with no valuestd::expected
containing an unexpected valueNull violation errors will be reported in the following cases:
Add new regression tests: