This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 14814 - Add asserts to test that something is a WebIDL interface or operation
Summary: Add asserts to test that something is a WebIDL interface or operation
Status: RESOLVED FIXED
Alias: None
Product: Testing
Classification: Unclassified
Component: testharness.js (show other bugs)
Version: unspecified
Hardware: All All
: P2 enhancement
Target Milestone: ---
Assignee: James Graham
QA Contact: James Graham
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-13 19:05 UTC by Aryeh Gregor
Modified: 2011-11-16 20:59 UTC (History)
1 user (show)

See Also:


Attachments
Proposed patch (10.50 KB, application/octet-stream)
2011-11-13 19:05 UTC, Aryeh Gregor
Details

Description Aryeh Gregor 2011-11-13 19:05:44 UTC
Created attachment 1044 [details]
Proposed patch

Patch submitted for review.  I've tested it in all major browsers, and it looks to be correct.  assert_interface works for common interfaces in IE9, and in Firefox 9.0a2 for NodeList (but not for others yet); WebKit and Opera have some bugs.  assert_operation likewise works in UAs, although max_args > 0 fails in some browsers because they make .length 0 always instead of equal to the maximum number of arguments.

There's one apparent WebIDL spec bug I caught, bug 14813.  I test for how browsers behave, not what the spec requires.  See also the two TODOs.
Comment 1 Aryeh Gregor 2011-11-15 00:16:14 UTC
IRC discussion suggested this would be better done by a function that would generate entire tests (not assertions), preferably something that just parsed an arbitrary IDL block.  This seems like a better approach than my patch.  I could hack my patch into an initial version of such a function, which just slurps out the interface name via regex.
Comment 2 Aryeh Gregor 2011-11-16 20:59:39 UTC
Pursuant to discussion, I wrote something up and checked it in.  It seems to work okay.  Lots more work is needed to test more things and improve the correctness of what's there.

http://w3c-test.org/html/tests/resources/idlharness.js
http://w3c-test.org/webapps/DOMCore/tests/submissions/AryehGregor/interfaces.html