summaryrefslogtreecommitdiffstats
path: root/addon-sdk/test/browser_sdk_loader_json.js
blob: 19f92cecd676ac3065c5c65f4be3ab203f3eb7cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function test () {
  let loader = makeLoader();
  let module = Module("./main", gTestPath);
  let require = Require(loader, module);

  /*
   * Relative resource:// URI of json
   */

  let data = require("./data.json");
  is(data.title, "jetpack mochitests", "loads relative JSON");
  is(data.dependencies.underscore, "1.0.0", "loads relative JSON");

  try {
    let data = require("./invalid.json");
    ok(false, "parsing an invalid JSON should throw");
  }
  catch (e) {
    ok(e, "parsing an invalid JSON should throw");
  }

  finish();
}