RESOLVED FIXED171698
Use EXPECT_EQ() when comparing strings in TestWebKitAPI tests
https://bugs.webkit.org/show_bug.cgi?id=171698
Summary Use EXPECT_EQ() when comparing strings in TestWebKitAPI tests
Daniel Bates
Reported 2017-05-04 15:46:42 PDT
We should use EXPECT_EQ() when comparing WTF::String objects so that we get pretty-printed difference output for both the expected result and actual results. This can help expedite the diagnosis of a regression. == Current Behavior == Suppose we change line <http://trac.webkit.org/browser/trunk/Tools/TestWebKitAPI/Tests/WTF/WTFString.cpp?rev=216131#L337> to purposely cause an failure: EXPECT_TRUE(reference.left(1) == String::fromUTF8("Ca")); Then run-api-tests will emit the following output: Tools/TestWebKitAPI/Tests/WTF/WTFString.cpp:337 Value of: reference.left(1) == String::fromUTF8("Ca") Actual: false Expected: true == Proposed Behavior == Suppose we change the same line to purposely failure and use EXPECT_EQ(): EXPECT_EQ(String::fromUTF8("Ca"), reference.left(1)); Then run-api-tests will emit the following output: Tools/TestWebKitAPI/Tests/WTF/WTFString.cpp:337 Value of: reference.left(1) Actual: C Expected: String::fromUTF8("Ca") Which is: Ca
Attachments
Patch (6.68 KB, patch)
2017-05-04 15:58 PDT, Daniel Bates
darin: review+
Daniel Bates
Comment 1 2017-05-04 15:48:00 PDT
(In reply to Daniel Bates from comment #0) > Suppose we change line > <http://trac.webkit.org/browser/trunk/Tools/TestWebKitAPI/Tests/WTF/ > WTFString.cpp?rev=216131#L337> to purposely cause an failure: The line should be <http://trac.webkit.org/browser/trunk/Tools/TestWebKitAPI/Tests/WTF/WTFString.cpp?rev=216131#L336>
Daniel Bates
Comment 2 2017-05-04 15:58:45 PDT
Daniel Bates
Comment 3 2017-05-05 11:45:24 PDT
Note You need to log in before you can comment on or make changes to this bug.