michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: let four = require("./modules/exportsEquals"); michael@0: exports.testExportsEquals = function(assert) { michael@0: assert.equal(four, 4); michael@0: }; michael@0: michael@0: /* TODO: Discuss idea of dropping support for this feature that was alternative michael@0: to `module.exports = ..` that failed. michael@0: let five = require("./modules/setExports"); michael@0: exports.testSetExports = function(assert) { michael@0: assert.equal(five, 5); michael@0: } michael@0: michael@0: exports.testDupeSetExports = function(assert) { michael@0: var passed = false; michael@0: try { michael@0: var dupe = require('./modules/dupeSetExports'); michael@0: } catch(e) { michael@0: passed = /define\(\) was used, so module\.exports= and module\.setExports\(\) may not be used/.test(e.toString()); michael@0: } michael@0: assert.equal(passed, true, 'define() or setExports(), not both'); michael@0: } michael@0: */ michael@0: michael@0: exports.testModule = function(assert) { michael@0: // module.id is not cast in stone yet. In the future, it may include the michael@0: // package name, or may possibly be a/ URL of some sort. For now, it's a michael@0: // URL that starts with resource: and ends with this module name, but the michael@0: // part in between varies depending upon how the test is run. michael@0: var found = /test-set-exports$/.test(module.id); michael@0: assert.equal(found, true, module.id+" ends with test-set-exports.js"); michael@0: }; michael@0: michael@0: require('sdk/test').run(exports);