Skip to content
This repository has been archived by the owner on Sep 19, 2018. It is now read-only.

idlharness.js could recursively test interfaces available as attributes #97

Closed
luser opened this issue Dec 11, 2014 · 3 comments
Closed

Comments

@luser
Copy link
Contributor

luser commented Dec 11, 2014

I was writing an idlharness.js test and I didn't realize at first that I had to explicitly add_objects for all of the attributes on my top-level object that implement other interfaces I want tested. The Gamepad spec has (edited for brevity):

interface GamepadEvent {
  readonly attribute Gamepad? gamepad;
};

interface Gamepad {
  readonly    attribute GamepadButton[]     buttons;
}

I kind of expected that when I added the full set of interfaces via add_idls and called:

idl_array.add_objects({
    GamepadEvent: [e]
});

that Gamepad and GamepadButton would be tested as they're reachable from GamepadEvent. That's not the case, however and I have to write:

idl_array.add_objects({
    GamepadEvent: [e],
    Gamepad: [e.gamepad],
    GamepadButton: [e.gamepad.buttons[0]]
});

It seems like we could do better here and auto-test everything that's reachable from anything passed to add_objects. (Also it might not hurt to have an error for something that's been passed to add_idls and not tested, which doesn't seem to be the case.)

@gsnedders
Copy link
Contributor

The argument against this behaviour is that one can debate as to how far one should go with this. It seems like we don't want to go too far such that we end up actually doing complex behaviour (that a UA could potentially fail—we are a test suite after all!) in trying to gather tests, as that's just a world of badness. On the other hand, as your example shows, people will often just have to write what we could automatically deduce, so we're relying on the same thing either way. Maybe we should limit it to something like a DFS for attributes (and not even call operations with no arguments)? I don't know what the right answer here is.

I agree we ought to have an error for things that have been passed to add_ids and not an object, though.

@inexorabletash
Copy link
Member

+1 to error; especially in tests where the IDL is pulled out into an external file (e.g. to support Window and XxxWorker variants), getting out of sync becomes quite easy.

@wpt-issue-mover
Copy link
Collaborator

This issue has been moved to web-platform-tests/wpt#7158; please continue all discussion there.

@w3c w3c locked and limited conversation to collaborators Aug 31, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants