Commit 11dafbf2 authored by Dominik Charousset's avatar Dominik Charousset

Fix UB in testing DSL

parent c2e5d867
...@@ -219,7 +219,13 @@ public: ...@@ -219,7 +219,13 @@ public:
template <class T> template <class T>
static std::string render(const T& x) { static std::string render(const T& x) {
if constexpr (std::is_constructible<string_view, T>::value) { if constexpr (std::is_same<std::nullptr_t, T>::value) {
return "null";
} else if constexpr (std::is_constructible<string_view, T>::value) {
if constexpr (std::is_pointer<T>::value) {
if (x == nullptr)
return "null";
}
auto str = string_view{x}; auto str = string_view{x};
return std::string{str.begin(), str.end()}; return std::string{str.begin(), str.end()};
} else { } else {
......
...@@ -40,7 +40,7 @@ CAF_TEST_FIXTURE_SCOPE(receive_buffer_tests, fixture) ...@@ -40,7 +40,7 @@ CAF_TEST_FIXTURE_SCOPE(receive_buffer_tests, fixture)
CAF_TEST(constructors) { CAF_TEST(constructors) {
CAF_CHECK_EQUAL(a.size(), 0ul); CAF_CHECK_EQUAL(a.size(), 0ul);
CAF_CHECK_EQUAL(a.capacity(), 0ul); CAF_CHECK_EQUAL(a.capacity(), 0ul);
CAF_CHECK_EQUAL(a.data(), nullptr); CAF_CHECK(a.data() == nullptr);
CAF_CHECK(a.empty()); CAF_CHECK(a.empty());
CAF_CHECK_EQUAL(b.size(), 1024ul); CAF_CHECK_EQUAL(b.size(), 1024ul);
CAF_CHECK_EQUAL(b.capacity(), 1024ul); CAF_CHECK_EQUAL(b.capacity(), 1024ul);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment