introspection: update name tests for clang-11
This commit is contained in:
parent
5a7613d3f3
commit
94d3f676c6
@ -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 ()
|
int main ()
|
||||||
{
|
{
|
||||||
@ -139,9 +173,13 @@ int main ()
|
|||||||
"templated_with_type"
|
"templated_with_type"
|
||||||
);
|
);
|
||||||
|
|
||||||
tap.expect_eq (
|
// The trailing '>' characters are separated by whitespace in GCC, and
|
||||||
cruft::introspection::name::full<templated_with_type<templated_with_type<int>>> (),
|
// Clang<11, but aren't meaningfully different in user interpretation.
|
||||||
std::string_view {"templated_with_type<templated_with_type<int> >"},
|
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"
|
"templated_with_type"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user