Bug 154714

Summary: Add API test coverage for parseHTMLInteger / parseHTMLNonNegativeInteger
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: DOMAssignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, darin, ggaren, sam
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Description Chris Dumez 2016-02-25 21:02:15 PST
Add API test coverage for parseHTMLInteger / parseHTMLNonNegativeInteger as per:
- https://html.spec.whatwg.org/multipage/infrastructure.html#signed-integers
- https://html.spec.whatwg.org/multipage/infrastructure.html#non-negative-integers
Comment 1 Chris Dumez 2016-02-25 21:05:37 PST
Created attachment 272293 [details]
Patch
Comment 2 Darin Adler 2016-02-26 07:52:13 PST
Comment on attachment 272293 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=272293&action=review

> Tools/TestWebKitAPI/Tests/WebCore/HTMLParserIdioms.cpp:72
> +    // Boundaries.
> +    EXPECT_EQ(-2147483648, testParseHTMLInteger("-2147483648"));
> +    EXPECT_EQ(2147483647, testParseHTMLInteger("2147483647"));

We should include failure case tests that are just outside the boundaries: -2147483649, 2147483648. And maybe some other "too long number" tests.

> Tools/TestWebKitAPI/Tests/WebCore/HTMLParserIdioms.cpp:74
> +    // Failure cases.

Might be good to also include expected failures that are legal floating point numbers such as "1.0", "1.", "1e1", ".1", "infinity". Some ways of implementing this might accidentally allow those.

> Tools/TestWebKitAPI/Tests/WebCore/HTMLParserIdioms.cpp:124
> +    EXPECT_EQ(4294967295u, testParseHTMLNonNegativeInteger("4294967295"));

We should include a failure case test that is just outside the boundary: 4294967296.

> Tools/TestWebKitAPI/Tests/WebCore/HTMLParserIdioms.cpp:126
> +    // Failure cases.

Might be good to also include expected failures that are legal floating point numbers such as "1.0", "1.", "1e1", ".1", "infinity". Some ways of implementing this might accidentally allow those.
Comment 3 Chris Dumez 2016-02-26 17:12:57 PST
Created attachment 272385 [details]
Patch
Comment 4 WebKit Commit Bot 2016-02-26 18:03:13 PST
Comment on attachment 272385 [details]
Patch

Clearing flags on attachment: 272385

Committed r197225: <http://trac.webkit.org/changeset/197225>
Comment 5 WebKit Commit Bot 2016-02-26 18:03:18 PST
All reviewed patches have been landed.  Closing bug.