2013-02-01 21:17:34 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2013-08-21 01:24:12 +00:00
|
|
|
'use strict';
|
2013-02-01 21:17:34 +00:00
|
|
|
|
2013-08-21 01:24:12 +00:00
|
|
|
Object.defineProperty(this, 'global', { value: this });
|
2013-02-01 21:17:34 +00:00
|
|
|
|
2013-08-21 01:24:12 +00:00
|
|
|
exports.testGlobals = function(assert) {
|
2013-02-01 21:17:34 +00:00
|
|
|
// the only globals in module scope should be:
|
2013-08-26 15:17:58 +00:00
|
|
|
// module, exports, require, dump, console
|
|
|
|
assert.equal(typeof module, 'object', 'have "module", good');
|
|
|
|
assert.equal(typeof exports, 'object', 'have "exports", good');
|
|
|
|
assert.equal(typeof require, 'function', 'have "require", good');
|
|
|
|
assert.equal(typeof dump, 'function', 'have "dump", good');
|
|
|
|
assert.equal(typeof console, 'object', 'have "console", good');
|
2013-02-01 21:17:34 +00:00
|
|
|
|
|
|
|
// in particular, these old globals should no longer be present
|
2013-08-26 15:17:58 +00:00
|
|
|
assert.ok(!('packaging' in global), "no 'packaging', good");
|
|
|
|
assert.ok(!('memory' in global), "no 'memory', good");
|
|
|
|
assert.ok(/test-globals\.js$/.test(module.uri),
|
|
|
|
'should contain filename');
|
|
|
|
};
|
2013-02-01 21:17:34 +00:00
|
|
|
|
2013-08-26 15:17:58 +00:00
|
|
|
exports.testComponent = function (assert) {
|
|
|
|
assert.throws(() => {
|
|
|
|
Components;
|
|
|
|
}, /`Components` is not available/, 'using `Components` throws');
|
2013-02-01 21:17:34 +00:00
|
|
|
};
|
2013-08-21 01:24:12 +00:00
|
|
|
|
2013-08-26 15:17:58 +00:00
|
|
|
require('test').run(exports);
|