This is an archive of the discontinued LLVM Phabricator instance.

[libc] Support StringView equality tests
ClosedPublic

Authored by michaelrj on Aug 5 2022, 3:06 PM.

Details

Summary

Previously, the integer_to_string tests used EXPECT_TRUE(.equals)
which doesn't have useful error messages. Now they properly check
equality with the EXPECT_EQ macro, which allows for comparing the
strings more naturally.

Diff Detail

Event Timeline

michaelrj created this revision.Aug 5 2022, 3:06 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptAug 5 2022, 3:06 PM
michaelrj requested review of this revision.Aug 5 2022, 3:06 PM

This will be fine there as long as __llvm_libc::cpp::StringView has an operator==. Though as a drive by comment here, I think the better way to compare StringView's would be to make sure they have an operator const char *() and just use EXPECT_STREQ

This will be fine there as long as __llvm_libc::cpp::StringView has an operator==. Though as a drive by comment here, I think the better way to compare StringView's would be to make sure they have an operator const char *() and just use EXPECT_STREQ

I don't think StringView data is necessarily null-terminated?

This will be fine there as long as __llvm_libc::cpp::StringView has an operator==. Though as a drive by comment here, I think the better way to compare StringView's would be to make sure they have an operator const char *() and just use EXPECT_STREQ

I don't think StringView data is necessarily null-terminated?

Ah thats right, sorry about the noise

I would guess the potential problem would be in describeValue since fuchsia might not know how to convert a StringView into a std::string for display

I would guess the potential problem would be in describeValue since fuchsia might not know how to convert a StringView into a std::string for display

Fuchcia does not use the LibcTest so describeValue does not come into play there.

rebase before landing

sivachandra accepted this revision.Aug 10 2022, 10:28 AM
This revision is now accepted and ready to land.Aug 10 2022, 10:28 AM
This revision was landed with ongoing or failed builds.Aug 10 2022, 11:24 AM
This revision was automatically updated to reflect the committed changes.