introspection: update name tests for clang-11

This commit is contained in:
Danny Robson 2020-10-22 08:38:59 +10:00
parent 5a7613d3f3
commit 94d3f676c6

View File

@ -72,6 +72,40 @@ equal (A &&a, B &&b)
}
///----------------------------------------------------------------------------
/// Returns true if the two strings are equal except for any embedded
/// whitespace.
static bool
whitespace_equal (std::string_view a, std::string_view b)
{
auto const a_size = std::ssize (a);
auto const b_size = std::ssize (b);
int a_cursor = 0;
int b_cursor = 0;
while (a_cursor < a_size && b_cursor < b_size) {
if (a[a_cursor] == ' ') {
++a_cursor;
continue;
}
if (b[b_cursor] == ' ') {
++b_cursor;
continue;
}
if (a[a_cursor] != b[b_cursor])
return false;
++a_cursor;
++b_cursor;
}
return a_cursor == a_size && b_cursor == b_size;
}
//-----------------------------------------------------------------------------
int main ()
{
@ -139,9 +173,13 @@ int main ()
"templated_with_type"
);
tap.expect_eq (
cruft::introspection::name::full<templated_with_type<templated_with_type<int>>> (),
std::string_view {"templated_with_type<templated_with_type<int> >"},
// The trailing '>' characters are separated by whitespace in GCC, and
// Clang<11, but aren't meaningfully different in user interpretation.
tap.expect (
whitespace_equal (
cruft::introspection::name::full<templated_with_type<templated_with_type<int>>> (),
std::string_view {"templated_with_type<templated_with_type<int>>"}
),
"templated_with_type"
);