mirror of
https://github.com/servo/servo.git
synced 2025-08-08 06:55:31 +01:00
Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255
This commit is contained in:
parent
b2a5225831
commit
1a81b18b9f
12321 changed files with 544385 additions and 6 deletions
|
@ -0,0 +1,42 @@
|
|||
|
||||
// NOTES:
|
||||
// - the errors actually still need to be reviewed to check that they
|
||||
// are fully correct interpretations of the IDLs
|
||||
|
||||
var wp = process.env.JSCOV ? require("../lib-cov/webidl2") : require("../lib/webidl2")
|
||||
, expect = require("expect.js")
|
||||
, pth = require("path")
|
||||
, fs = require("fs")
|
||||
;
|
||||
describe("Parses all of the invalid IDLs to check that they blow up correctly", function () {
|
||||
var dir = pth.join(__dirname, "invalid/idl")
|
||||
, skip = {}
|
||||
, idls = fs.readdirSync(dir)
|
||||
.filter(function (it) { return (/\.w?idl$/).test(it) && !skip[it]; })
|
||||
.map(function (it) { return pth.join(dir, it); })
|
||||
, errors = idls.map(function (it) { return pth.join(__dirname, "invalid", "json", pth.basename(it).replace(/\.w?idl/, ".json")); })
|
||||
;
|
||||
|
||||
for (var i = 0, n = idls.length; i < n; i++) {
|
||||
var idl = idls[i], error = JSON.parse(fs.readFileSync(errors[i], "utf8"));
|
||||
var func = (function (idl, err) {
|
||||
return function () {
|
||||
var error;
|
||||
try {
|
||||
var ast = wp.parse(fs.readFileSync(idl, "utf8"));
|
||||
console.log(JSON.stringify(ast, null, 4));
|
||||
}
|
||||
catch (e) {
|
||||
error = e;
|
||||
}
|
||||
finally {
|
||||
expect(error).to.be.ok();
|
||||
expect(error.message).to.equal(err.message);
|
||||
expect(error.line).to.equal(err.line);
|
||||
}
|
||||
|
||||
};
|
||||
}(idl, error));
|
||||
it("should produce the right error for " + idl, func);
|
||||
}
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue