Bug 154714 - Add API test coverage for parseHTMLInteger / parseHTMLNonNegativeInteger
Summary: Add API test coverage for parseHTMLInteger / parseHTMLNonNegativeInteger
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-25 21:02 PST by Chris Dumez
Modified: 2016-02-26 18:03 PST (History)
4 users (show)

See Also:


Attachments
Patch (16.88 KB, patch)
2016-02-25 21:05 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (17.89 KB, patch)
2016-02-26 17:12 PST, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.