diff --git a/test/language/module-code/namespace/internals/enumerate-binding-uninit.js b/test/language/module-code/namespace/internals/enumerate-binding-uninit.js new file mode 100644 index 0000000000000000000000000000000000000000..a56408e8d80c5b1806e2916c8ec4debe352951d8 --- /dev/null +++ b/test/language/module-code/namespace/internals/enumerate-binding-uninit.js @@ -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; diff --git a/test/language/module-code/namespace/internals/object-hasOwnProperty-binding-uninit.js b/test/language/module-code/namespace/internals/object-hasOwnProperty-binding-uninit.js new file mode 100644 index 0000000000000000000000000000000000000000..fc90814fbbbe4fae403de3c00981ff60e5b7df22 --- /dev/null +++ b/test/language/module-code/namespace/internals/object-hasOwnProperty-binding-uninit.js @@ -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; diff --git a/test/language/module-code/namespace/internals/object-keys-binding-uninit.js b/test/language/module-code/namespace/internals/object-keys-binding-uninit.js new file mode 100644 index 0000000000000000000000000000000000000000..842ae50d6e72dc381cdac91719f5010f29e4a14d --- /dev/null +++ b/test/language/module-code/namespace/internals/object-keys-binding-uninit.js @@ -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; diff --git a/test/language/module-code/namespace/internals/object-propertyIsEnumerable-binding-uninit.js b/test/language/module-code/namespace/internals/object-propertyIsEnumerable-binding-uninit.js new file mode 100644 index 0000000000000000000000000000000000000000..285a6c9af28f9f1ed772310fe7b322245beec7ff --- /dev/null +++ b/test/language/module-code/namespace/internals/object-propertyIsEnumerable-binding-uninit.js @@ -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;