addon-sdk/test/browser_sdk_loader_json.js

branch
TOR_BUG_9701
changeset 10
ac0c01689b40
equal deleted inserted replaced
-1:000000000000 0:dab19566b2d1
1 function test () {
2 let loader = makeLoader();
3 let module = Module("./main", gTestPath);
4 let require = Require(loader, module);
5
6 /*
7 * Relative resource:// URI of json
8 */
9
10 let data = require("./data.json");
11 is(data.title, "jetpack mochitests", "loads relative JSON");
12 is(data.dependencies.underscore, "1.0.0", "loads relative JSON");
13
14 try {
15 let data = require("./invalid.json");
16 ok(false, "parsing an invalid JSON should throw");
17 }
18 catch (e) {
19 ok(e, "parsing an invalid JSON should throw");
20 }
21
22 finish();
23 }

mercurial