|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 let four = require("./modules/exportsEquals"); |
|
6 exports.testExportsEquals = function(assert) { |
|
7 assert.equal(four, 4); |
|
8 }; |
|
9 |
|
10 /* TODO: Discuss idea of dropping support for this feature that was alternative |
|
11 to `module.exports = ..` that failed. |
|
12 let five = require("./modules/setExports"); |
|
13 exports.testSetExports = function(assert) { |
|
14 assert.equal(five, 5); |
|
15 } |
|
16 |
|
17 exports.testDupeSetExports = function(assert) { |
|
18 var passed = false; |
|
19 try { |
|
20 var dupe = require('./modules/dupeSetExports'); |
|
21 } catch(e) { |
|
22 passed = /define\(\) was used, so module\.exports= and module\.setExports\(\) may not be used/.test(e.toString()); |
|
23 } |
|
24 assert.equal(passed, true, 'define() or setExports(), not both'); |
|
25 } |
|
26 */ |
|
27 |
|
28 exports.testModule = function(assert) { |
|
29 // module.id is not cast in stone yet. In the future, it may include the |
|
30 // package name, or may possibly be a/ URL of some sort. For now, it's a |
|
31 // URL that starts with resource: and ends with this module name, but the |
|
32 // part in between varies depending upon how the test is run. |
|
33 var found = /test-set-exports$/.test(module.id); |
|
34 assert.equal(found, true, module.id+" ends with test-set-exports.js"); |
|
35 }; |
|
36 |
|
37 require('sdk/test').run(exports); |