Skip to content

Commit

Permalink
Count partial mixins as deps
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Bjerring committed Nov 5, 2018
1 parent fb4466f commit 340b297
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 4 deletions.
22 changes: 18 additions & 4 deletions resources/idlharness.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,15 +298,29 @@ IdlArray.prototype.add_dependency_idls = function(raw_idls, options)
}.bind(this));

deps.forEach(function(name) {
new_options.only.push(name);
if (!new_options.only.includes(name)) {
new_options.only.push(name);
}

const follow_up = new Set();
for (const dep_type of ["inheritance", "implements", "includes"]) {
if (parsed[dep_type]) {
const inheriting = parsed[dep_type];
const inheritor = parsed.name || parsed.target;
for (const dep of [inheriting, inheritor]) {
new_options.only.push(dep);
const deps = [inheriting];
// For A includes B, we can ignore A, unless B (or some of its
// members) is being tested.
if (dep_type !== "includes"
|| inheriting in this.members && !this.members[inheriting].untested
|| this.partials.some(function(p) {
return p.name === inheriting;
})) {
deps.push(inheritor);
}
for (const dep of deps) {
if (!new_options.only.includes(dep)) {
new_options.only.push(dep);
}
all_deps.add(dep);
follow_up.add(dep);
}
Expand All @@ -320,7 +334,7 @@ IdlArray.prototype.add_dependency_idls = function(raw_idls, options)
next.forEach(process);
}
}
});
}.bind(this));
}.bind(this);

for (let parsed of parsed_idls) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,37 @@
namespace E {};`);
idlArray.collapse_partials();
})();

(() => {
const idlArray = new IdlArray();
idlArray.add_idls(`
partial interface F {};
partial interface mixin G{};
`);
idlArray.add_dependency_idls(`
interface F {};
interface mixin G {};
interface mixin H {};
F includes H;
I includes H;
J includes G;
interface K : J {};
interface L : F {};
`);
test(() => {
// F is tested, so H is a dep.
assert_true('F' in idlArray.includes, 'Fs includes should be picked up');
assert_true(idlArray.includes.F.includes('H'), 'H should be picked up');
// H is not tested, so I is not a dep.
assert_false('I' in idlArray.includes, 'I should be ignored');
// G is a dep, so J is a dep.
assert_true('J' in idlArray.includes, 'J should be picked up');
// But, K isn't a dep just because of J.
assert_false('K' in idlArray.members, 'K should be ignored');
// L inherits F, so should be picked up.
assert_false('L' in idlArray.members, 'L should be picked up');
}, 'partial mixin dep implications');
})();
</script>
<script type="text/json" id="expected">
{
Expand Down Expand Up @@ -118,6 +149,12 @@
"status_string": "FAIL",
"properties": {},
"message": "assert_true: Original E definition should have type interface expected true got false"
},
{
"name": "partial mixin dep implications",
"status_string": "PASS",
"properties": {},
"message": null
}
],
"type": "complete"
Expand Down

0 comments on commit 340b297

Please sign in to comment.