mirror of https://github.com/tc39/test262.git
Add `System.global` tests (#567)
This commit is contained in:
parent
6b7cbb5035
commit
45e5fc8889
|
@ -0,0 +1,30 @@
|
||||||
|
// Copyright (C) 2016 Jordan Harband. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-system
|
||||||
|
description: The System object is an ordinary object.
|
||||||
|
info: >
|
||||||
|
The System Object
|
||||||
|
|
||||||
|
The System object is the %System% intrinsic object and the initial value of
|
||||||
|
the System property of the global object. The System object is an ordinary
|
||||||
|
object.
|
||||||
|
|
||||||
|
The System object is not a function object. It does not have a [[Construct]]
|
||||||
|
internal method; it is not possible to use the System object as a constructor
|
||||||
|
with the new operator. The System object also does not have a [[Call]]
|
||||||
|
internal method; it is not possible to invoke the System object as a
|
||||||
|
function.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
assert.sameValue(typeof System, 'object', '`typeof System` is `"object"`');
|
||||||
|
|
||||||
|
// System is not callable
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
System();
|
||||||
|
});
|
||||||
|
|
||||||
|
// System doesn't have a constructor
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
new System();
|
||||||
|
});
|
|
@ -0,0 +1,26 @@
|
||||||
|
// Copyright (C) 2016 Jordan Harband. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-system.global
|
||||||
|
description: System.global should be the global object
|
||||||
|
author: Jordan Harband
|
||||||
|
includes: [propertyHelper.js]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
assert.sameValue(this, System.global);
|
||||||
|
|
||||||
|
assert.sameValue(Array, System.global.Array);
|
||||||
|
assert.sameValue(Boolean, System.global.Boolean);
|
||||||
|
assert.sameValue(Date, System.global.Date);
|
||||||
|
assert.sameValue(Error, System.global.Error);
|
||||||
|
assert.sameValue(Function, System.global.Function);
|
||||||
|
assert.sameValue(JSON, System.global.JSON);
|
||||||
|
assert.sameValue(Math, System.global.Math);
|
||||||
|
assert.sameValue(Number, System.global.Number);
|
||||||
|
assert.sameValue(RegExp, System.global.RegExp);
|
||||||
|
assert.sameValue(String, System.global.String);
|
||||||
|
assert.sameValue(System, System.global.System);
|
||||||
|
|
||||||
|
globalVariable = {};
|
||||||
|
assert.sameValue(globalVariable, System.global.globalVariable);
|
|
@ -0,0 +1,13 @@
|
||||||
|
// Copyright (C) 2016 Jordan Harband. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-system.global
|
||||||
|
description: System.global should be non-writable, non-enumerable, and configurable
|
||||||
|
author: Jordan Harband
|
||||||
|
includes: [propertyHelper.js]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
verifyNotEnumerable(System, 'global');
|
||||||
|
verifyNotWritable(System, 'global');
|
||||||
|
verifyConfigurable(System, 'global');
|
|
@ -0,0 +1,14 @@
|
||||||
|
// Copyright (C) 2016 Jordan Harband. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: system
|
||||||
|
description: >
|
||||||
|
The value of the [[Prototype]] internal slot of the System object
|
||||||
|
is the intrinsic object %ObjectPrototype% (19.1.3).
|
||||||
|
---*/
|
||||||
|
|
||||||
|
assert.sameValue(
|
||||||
|
Object.getPrototypeOf(System),
|
||||||
|
Object.prototype,
|
||||||
|
'`Object.getPrototypeOf(System)` returns `Object.prototype`'
|
||||||
|
);
|
|
@ -0,0 +1,14 @@
|
||||||
|
// Copyright (C) 2016 Jordan Harband. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: system
|
||||||
|
description: >
|
||||||
|
System is configurable, writable, and not enumerable.
|
||||||
|
info: >
|
||||||
|
17 ECMAScript Standard Built-in Objects
|
||||||
|
includes: [propertyHelper.js]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
verifyNotEnumerable(this, 'System');
|
||||||
|
verifyWritable(this, 'System');
|
||||||
|
verifyConfigurable(this, 'System');
|
Loading…
Reference in New Issue