diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/resources/webidl2/test/web/run-tests.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/resources/webidl2/test/web/run-tests.js')
-rw-r--r-- | testing/web-platform/tests/resources/webidl2/test/web/run-tests.js | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/testing/web-platform/tests/resources/webidl2/test/web/run-tests.js b/testing/web-platform/tests/resources/webidl2/test/web/run-tests.js new file mode 100644 index 000000000..a72800b8b --- /dev/null +++ b/testing/web-platform/tests/resources/webidl2/test/web/run-tests.js @@ -0,0 +1,48 @@ + +describe("Parses all of the IDLs to produce the correct ASTs", function () { + for (var i = 0, n = data.valid.idl.length; i < n; i++) { + var idl = data.valid.idl[i], json = data.valid.json[i]; + var func = (function (idl, json) { + return function () { + try { + // the AST contains NaN and +/-Infinity that cannot be serialised to JSON + // the stored JSON ASTs use the same replacement function as is used below + // so we compare based on that + var diff = jsondiffpatch.diff(json, WebIDL2.parse(idl)); + if (diff && debug) console.log(JSON.stringify(diff, null, 4)); + expect(diff).to.be(undefined); + } + catch (e) { + console.log(e.toString()); + throw e; + } + }; + }(idl, json)); + it("should produce the same AST for " + i, func); + } +}); + +describe("Parses all of the invalid IDLs to check that they blow up correctly", function () { + for (var i = 0, n = data.invalid.idl.length; i < n; i++) { + var idl = data.invalid.idl[i], error = data.invalid.json[i]; + var func = (function (idl, err) { + return function () { + var error; + try { + var ast = WebIDL2.parse(idl); + 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 " + i, func); + } +}); |