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