WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
171698
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+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
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
Created
attachment 309111
[details]
Patch
Daniel Bates
Comment 3
2017-05-05 11:45:24 PDT
Committed
r216255
: <
http://trac.webkit.org/changeset/216255
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug