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/make-web-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/make-web-tests.js')
-rw-r--r-- | testing/web-platform/tests/resources/webidl2/test/web/make-web-tests.js | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/testing/web-platform/tests/resources/webidl2/test/web/make-web-tests.js b/testing/web-platform/tests/resources/webidl2/test/web/make-web-tests.js new file mode 100644 index 000000000..34c5a5c2b --- /dev/null +++ b/testing/web-platform/tests/resources/webidl2/test/web/make-web-tests.js @@ -0,0 +1,51 @@ + +// generates tests that work in a browser + +// XXX +// have it run through valid and invalid properly + +var pth = require("path") +, fs = require("fs") +, dir = function (path) { + return pth.join(__dirname, "..", path); + } +, allFromDir = function (dir, ext, asJSON) { + return fs.readdirSync(dir) + .filter(function (it) { return ext.test(it); }) + .map(function (it) { + var cnt = fs.readFileSync(pth.join(dir, it), "utf8"); + return asJSON ? JSON.parse(cnt) : cnt; + }); + } +, data = { + valid: { + json: allFromDir(dir("syntax/json"), /\.json$/, true) + , idl: allFromDir(dir("syntax/idl"), /\.w?idl$/, false) + } + , invalid:{ + json: allFromDir(dir("invalid/json"), /\.json$/, true) + , idl: allFromDir(dir("invalid/idl"), /\.w?idl$/, false) + } + } +, html = [ + "<!DOCTYPE html>" + , "<html>" + , " <head><meta charset='utf-8''><link rel='stylesheet' href='../../node_modules/mocha/mocha.css'>" + , " <title>WebIDL2 Browser Tests</title>" + , " <script>var data = " + JSON.stringify(data) + "</script>" + , " </head>" + , " <body><div id='mocha'></div>" + , " <script src='https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js'></script>" + , " <script src='../../node_modules/expect.js/expect.js'></script>" + , " <script src='../../node_modules/mocha/mocha.js'></script>" + , " <script src='../../node_modules/jsondiffpatch/jsondiffpatch.min.js'></script>" + , " <script src='../../lib/webidl2.js'></script>" + , " <script>mocha.setup('bdd');</script>" + , " <script src='run-tests.js'></script>" + , " <script>mocha.run();</script>" + , " </body>" + , "</html>" + ].join("\n") +; + +fs.writeFileSync("browser-tests.html", html, "utf8"); |