-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Labels:
-
Service Arch
Sometimes in unittests, you'd like to check that a pointer is nullptr.
You can't use the comparison macros like: ASSERT_EQ(ptr, nullptr) because none of the overloads satisfy: we can't use the one made for pointers here because nullptr is not a pointer according to std::is_pointer, and we can't use the generic one because the actual ptr is a pointer according to std::is_pointer.
You could just use ASSERT_FALSE(ptr), but this has limited utility, because on failure it will just print "Expected: !(ptr)" rather than the actual value of the pointer. But when we see this message in logs in a hard-to-repro failure, it would be useful to see the actual value (is the pointer corrupted? or is it just set to something when it shouldn't be?)