michael@0: function test () { michael@0: let loader = makeLoader(); michael@0: let module = Module("./main", gTestPath); michael@0: let require = Require(loader, module); michael@0: michael@0: try { michael@0: let Model = require("./cant-find-me"); michael@0: ok(false, "requiring a JS module that doesn't exist should throw"); michael@0: } michael@0: catch (e) { michael@0: ok(e, "requiring a JS module that doesn't exist should throw"); michael@0: } michael@0: michael@0: michael@0: /* michael@0: * Relative resource:// URI of JS michael@0: */ michael@0: michael@0: let { square } = require("./math"); michael@0: is(square(5), 25, "loads relative URI of JS"); michael@0: michael@0: /* michael@0: * Absolute resource:// URI of JS michael@0: */ michael@0: michael@0: let { has } = require("resource://gre/modules/commonjs/sdk/util/array"); michael@0: let testArray = ['rock', 'paper', 'scissors']; michael@0: michael@0: ok(has(testArray, 'rock'), "loads absolute resource:// URI of JS"); michael@0: ok(!has(testArray, 'dragon'), "loads absolute resource:// URI of JS"); michael@0: michael@0: finish(); michael@0: }