mirror of https://github.com/tc39/test262.git
Add tests for uninitialized bindings when accessed through Object methods and for-in
This commit is contained in:
parent
9f39d988e1
commit
3ce00cf5e3
|
@ -0,0 +1,42 @@
|
|||
// Copyright (C) 2017 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
id: sec-enumerate-object-properties
|
||||
info: >
|
||||
Test for-in enumeration with uninitialized binding.
|
||||
description: |
|
||||
13.7.5.15 EnumerateObjectProperties (O)
|
||||
...
|
||||
EnumerateObjectProperties must obtain the own property keys of the
|
||||
target object by calling its [[OwnPropertyKeys]] internal method.
|
||||
Property attributes of the target object must be obtained by
|
||||
calling its [[GetOwnProperty]] internal method.
|
||||
|
||||
9.4.6.4 [[GetOwnProperty]] (P)
|
||||
...
|
||||
4. Let value be ? O.[[Get]](P, O).
|
||||
...
|
||||
|
||||
9.4.6.7 [[Get]] (P, Receiver)
|
||||
...
|
||||
12. Let targetEnvRec be targetEnv's EnvironmentRecord.
|
||||
13. Return ? targetEnvRec.GetBindingValue(binding.[[BindingName]], true).
|
||||
|
||||
8.1.1.1.6 GetBindingValue ( N, S )
|
||||
...
|
||||
If the binding for N in envRec is an uninitialized binding, throw a ReferenceError exception.
|
||||
...
|
||||
|
||||
flags: [module]
|
||||
---*/
|
||||
|
||||
import* as self from "./enumerate-binding-uninit.js";
|
||||
|
||||
assert.throws(ReferenceError, function() {
|
||||
for (var key in self) {
|
||||
throw new Test262Error();
|
||||
}
|
||||
});
|
||||
|
||||
export default 0;
|
|
@ -0,0 +1,42 @@
|
|||
// Copyright (C) 2017 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
id: sec-object.prototype.hasownproperty
|
||||
info: >
|
||||
Test Object.prototype.hasOwnProperty() with uninitialized binding.
|
||||
description: |
|
||||
19.1.3.2 Object.prototype.hasOwnProperty ( V )
|
||||
...
|
||||
3. Return ? HasOwnProperty(O, P).
|
||||
|
||||
7.3.11 HasOwnProperty ( O, P )
|
||||
...
|
||||
3. Let desc be ? O.[[GetOwnProperty]](P).
|
||||
...
|
||||
|
||||
9.4.6.4 [[GetOwnProperty]] (P)
|
||||
...
|
||||
4. Let value be ? O.[[Get]](P, O).
|
||||
...
|
||||
|
||||
9.4.6.7 [[Get]] (P, Receiver)
|
||||
...
|
||||
12. Let targetEnvRec be targetEnv's EnvironmentRecord.
|
||||
13. Return ? targetEnvRec.GetBindingValue(binding.[[BindingName]], true).
|
||||
|
||||
8.1.1.1.6 GetBindingValue ( N, S )
|
||||
...
|
||||
If the binding for N in envRec is an uninitialized binding, throw a ReferenceError exception.
|
||||
...
|
||||
|
||||
flags: [module]
|
||||
---*/
|
||||
|
||||
import* as self from "./object-hasOwnProperty-binding-uninit.js";
|
||||
|
||||
assert.throws(ReferenceError, function() {
|
||||
Object.prototype.hasOwnProperty.call(self, "default");
|
||||
});
|
||||
|
||||
export default 0;
|
|
@ -0,0 +1,45 @@
|
|||
// Copyright (C) 2017 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
id: sec-object.keys
|
||||
info: >
|
||||
Test Object.keys() with uninitialized binding.
|
||||
description: |
|
||||
19.1.2.16 Object.keys ( O )
|
||||
...
|
||||
2. Let nameList be ? EnumerableOwnProperties(obj, "key").
|
||||
...
|
||||
|
||||
7.3.21 EnumerableOwnProperties ( O, kind )
|
||||
...
|
||||
4. For each element key of ownKeys in List order, do
|
||||
a. If Type(key) is String, then
|
||||
i. Let desc be ? O.[[GetOwnProperty]](key).
|
||||
...
|
||||
|
||||
9.4.6.4 [[GetOwnProperty]] (P)
|
||||
...
|
||||
4. Let value be ? O.[[Get]](P, O).
|
||||
...
|
||||
|
||||
9.4.6.7 [[Get]] (P, Receiver)
|
||||
...
|
||||
12. Let targetEnvRec be targetEnv's EnvironmentRecord.
|
||||
13. Return ? targetEnvRec.GetBindingValue(binding.[[BindingName]], true).
|
||||
|
||||
8.1.1.1.6 GetBindingValue ( N, S )
|
||||
...
|
||||
If the binding for N in envRec is an uninitialized binding, throw a ReferenceError exception.
|
||||
...
|
||||
|
||||
flags: [module]
|
||||
---*/
|
||||
|
||||
import* as self from "./object-keys-binding-uninit.js";
|
||||
|
||||
assert.throws(ReferenceError, function() {
|
||||
Object.keys(self);
|
||||
});
|
||||
|
||||
export default 0;
|
|
@ -0,0 +1,38 @@
|
|||
// Copyright (C) 2017 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
id: sec-object.prototype.propertyisenumerable
|
||||
info: >
|
||||
Test Object.prototype.propertyIsEnumerable() with uninitialized binding.
|
||||
description: |
|
||||
19.1.3.4 Object.prototype.propertyIsEnumerable ( V )
|
||||
...
|
||||
3. Let desc be ? O.[[GetOwnProperty]](P).
|
||||
...
|
||||
|
||||
9.4.6.4 [[GetOwnProperty]] (P)
|
||||
...
|
||||
4. Let value be ? O.[[Get]](P, O).
|
||||
...
|
||||
|
||||
9.4.6.7 [[Get]] (P, Receiver)
|
||||
...
|
||||
12. Let targetEnvRec be targetEnv's EnvironmentRecord.
|
||||
13. Return ? targetEnvRec.GetBindingValue(binding.[[BindingName]], true).
|
||||
|
||||
8.1.1.1.6 GetBindingValue ( N, S )
|
||||
...
|
||||
If the binding for N in envRec is an uninitialized binding, throw a ReferenceError exception.
|
||||
...
|
||||
|
||||
flags: [module]
|
||||
---*/
|
||||
|
||||
import* as self from "./object-propertyIsEnumerable-binding-uninit.js";
|
||||
|
||||
assert.throws(ReferenceError, function() {
|
||||
Object.prototype.propertyIsEnumerable.call(self, "default");
|
||||
});
|
||||
|
||||
export default 0;
|
Loading…
Reference in New Issue