[Webkit-unassigned] [Bug 171698] New: Use EXPECT_EQ() when comparing strings in TestWebKitAPI tests

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu May 4 15:46:42 PDT 2017


https://bugs.webkit.org/show_bug.cgi?id=171698

            Bug ID: 171698
           Summary: Use EXPECT_EQ() when comparing strings in
                    TestWebKitAPI tests
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: All
                OS: All
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Tools / Tests
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: dbates at webkit.org
                CC: lforschler at apple.com

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

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20170504/61c1399d/attachment.html>


More information about the webkit-unassigned mailing list