2013-02-01 13:17:34 -08: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-20 18:24:12 -07:00
|
|
|
'use strict';
|
2013-02-01 13:17:34 -08:00
|
|
|
|
2013-08-20 18:24:12 -07:00
|
|
|
Object.defineProperty(this, 'global', { value: this });
|
2013-02-01 13:17:34 -08:00
|
|
|
|
2013-08-20 18:24:12 -07:00
|
|
|
exports.testGlobals = function(assert) {
|
2013-02-01 13:17:34 -08:00
|
|
|
// the only globals in module scope should be:
|
2013-08-26 08:17:58 -07: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 13:17:34 -08:00
|
|
|
|
|
|
|
// in particular, these old globals should no longer be present
|
2013-08-26 08:17:58 -07: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 13:17:34 -08:00
|
|
|
|
2013-08-26 08:17:58 -07:00
|
|
|
exports.testComponent = function (assert) {
|
|
|
|
assert.throws(() => {
|
|
|
|
Components;
|
|
|
|
}, /`Components` is not available/, 'using `Components` throws');
|
2013-02-01 13:17:34 -08:00
|
|
|
};
|
2013-08-20 18:24:12 -07:00
|
|
|
|
2013-08-26 08:17:58 -07:00
|
|
|
require('test').run(exports);
|