On Tue Nov 19 18:37:24 2024 +0000, Gabriel Ivăncescu wrote:
What i mean is, if wine exposes (wrongly) "foobar" from an object I can't make that todo_wine, but I can if Windows exposes "barfoo" while wine does not.
Being able to express that `todo_wine` sounds useful then. I guess that would be a reason to decouple property array from todos. It would mean passing twice properties that are missing in Wine, but that doesn't seem too bad, esp. if we could use it to decrypt the test. One way I could imagine it would be to have a global helper that's not at all specific to prototypes (so no special "constructor" property handling):
``` function test_own_props(obj, props, todos) { // we can just use something like todo_wine_if(todos && todos.indexOf(prop_name) != 1) } ```
Move all your test to separated tests, "prototypes" is long enough. Then define a local helper: ``` function check(constr, props, todos) { // a hack really, but also an interesting test on its own; we don't need todo_wine for constructor property after it ok(constr.prototype.constructor === constr, "...");
props.push("constructor"); // concatenate arrays from arguments[3..arguments.length-1]; this gives a convenient way to handle version specific props test_own_props(constr.prototype, props, todos); } ```
The test would be then a series of calls, like: ``` check(CustomEvent, ["detail", "initCustomEvent"]); check(MessageEvent, ["data", "initMessageEvent", "origin", "source"], null, v >= 10 ? ["ports"] : null); check(Evemt, ["AT_TARGET", ...], ["AT_TARGET", ...]); ```