Remove tests for module namespace iterator (#810)

This commit is contained in:
Kevin Gibbons 2016-12-28 11:57:46 -07:00 committed by Tom Care
parent d9732d8323
commit 03453d6098
19 changed files with 21 additions and 529 deletions

View File

@ -0,0 +1,12 @@
// Copyright (C) 2016 Kevin Gibbons. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-@@iterator
description: Module namespace objects lack a Symbol.iterator property.
flags: [module]
features: [Symbol.iterator]
---*/
import * as ns from './Symbol.iterator.js';
assert.sameValue(Object.prototype.hasOwnProperty.call(ns, Symbol.iterator), false);

View File

@ -1,30 +0,0 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-@@iterator
es6id: 26.3.2
description: Length of @@iterator method
info: >
ES6 Section 17:
Every built-in Function object, including constructors, has a length
property whose value is an integer. Unless otherwise specified, this value
is equal to the largest number of named arguments shown in the subclause
headings for the function description, including optional parameters.
[...]
Unless otherwise specified, the length property of a built-in Function
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
[[Configurable]]: true }.
flags: [module]
includes: [propertyHelper.js]
features: [Symbol.iterator]
---*/
import * as ns from './length.js';
assert.sameValue(ns[Symbol.iterator].length, 0);
verifyNotEnumerable(ns[Symbol.iterator], 'length');
verifyNotWritable(ns[Symbol.iterator], 'length');
verifyConfigurable(ns[Symbol.iterator], 'length');

View File

@ -1,32 +0,0 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-@@iterator
es6id: 26.3.2
description: Length of List iterator returned by @@iterator method
info: >
ES6 Section 17:
Every built-in Function object, including constructors, has a length
property whose value is an integer. Unless otherwise specified, this value
is equal to the largest number of named arguments shown in the subclause
headings for the function description, including optional parameters.
[...]
Unless otherwise specified, the length property of a built-in Function
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
[[Configurable]]: true }.
flags: [module]
includes: [propertyHelper.js]
features: [Symbol.iterator]
---*/
import * as ns from './list-iter-next-length.js';
var next = ns[Symbol.iterator]().next;
assert.sameValue(next.length, 0);
verifyNotEnumerable(next, 'length');
verifyNotWritable(next, 'length');
verifyConfigurable(next, 'length');

View File

@ -1,37 +0,0 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-@@iterator
es6id: 26.3.2
description: >
Descriptor for `name` property of ListIterator returned by @@iterator
method
info: >
The value of the name property of this function is "[Symbol.iterator]".
ES6 Section 17: ECMAScript Standard Built-in Objects
Every built-in Function object, including constructors, that is not
identified as an anonymous function has a name property whose value is a
String. Unless otherwise specified, this value is the name that is given to
the function in this specification.
[...]
Unless otherwise specified, the name property of a built-in Function
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
flags: [module]
features: [Symbol.iterator]
includes: [propertyHelper.js]
---*/
import * as ns from './list-iter-next-name.js';
var next = ns[Symbol.iterator]().next;
assert.sameValue(next.name, 'next');
verifyNotEnumerable(next, 'name');
verifyNotWritable(next, 'name');
verifyConfigurable(next, 'name');

View File

@ -1,24 +0,0 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-@@iterator
es6id: 26.3.2
description: Property descriptor
info: >
ES6 Section 17
Every other data property described in clauses 18 through 26 and in Annex
B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false,
[[Configurable]]: true } unless otherwise specified.
flags: [module]
includes: [propertyHelper.js]
features: [Symbol.iterator]
---*/
import * as ns from './list-iter-next-prop-desc.js';
var iter = ns[Symbol.iterator]();
assert.sameValue(typeof iter.next, 'function');
verifyNotEnumerable(iter, 'next');
verifyWritable(iter, 'next');
verifyConfigurable(iter, 'next');

View File

@ -1,33 +0,0 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-@@iterator
es6id: 26.3.2
description: Descriptor for `name` property
info: >
The value of the name property of this function is "[Symbol.iterator]".
ES6 Section 17: ECMAScript Standard Built-in Objects
Every built-in Function object, including constructors, that is not
identified as an anonymous function has a name property whose value is a
String. Unless otherwise specified, this value is the name that is given to
the function in this specification.
[...]
Unless otherwise specified, the name property of a built-in Function
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
flags: [module]
features: [Symbol.iterator]
includes: [propertyHelper.js]
---*/
import * as ns from './name.js';
assert.sameValue(ns[Symbol.iterator].name, '[Symbol.iterator]');
verifyNotEnumerable(ns[Symbol.iterator], 'name');
verifyNotWritable(ns[Symbol.iterator], 'name');
verifyConfigurable(ns[Symbol.iterator], 'name');

View File

@ -1,29 +0,0 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-@@iterator
es6id: 26.3.2
description: Property descriptor
info: >
ES6 Section 17
Every other data property described in clauses 18 through 26 and in Annex
B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false,
[[Configurable]]: true } unless otherwise specified.
flags: [module]
features: [Symbol.iterator]
---*/
import * as ns from './prop-desc.js';
assert.sameValue(typeof ns[Symbol.iterator], 'function');
// propertyHelper.js is not appropriate for this test because it assumes that
// the object exposes the ordinary object's implementation of [[Get]], [[Set]],
// [[Delete]], and [[OwnPropertyKeys]], which the module namespace exotic
// object does not.
var desc = Object.getOwnPropertyDescriptor(ns, Symbol.iterator);
assert.sameValue(desc.enumerable, false, 'reports as non-enumerable');
assert.sameValue(desc.writable, true, 'reports as writable');
assert.sameValue(desc.configurable, true, 'reports as configurable');

View File

@ -1,48 +0,0 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-@@iterator
es6id: 26.3.2
description: >
Behavior when the `this` value is not a module namespace exotic object
info: |
1. Let N be the this value.
2. If N is not a module namespace exotic object, throw a TypeError
exception.
flags: [module]
features: [Symbol.iterator]
---*/
import * as ns from './this-val-not-ns.js';
var iter = ns[Symbol.iterator];
assert.sameValue(typeof iter, 'function');
assert.throws(TypeError, function() {
iter();
}, 'undefined');
assert.throws(TypeError, function() {
iter.call({});
}, 'ordinary object');
assert.throws(TypeError, function() {
iter.call([]);
}, 'Array exotic object');
assert.throws(TypeError, function() {
iter.call(23);
}, 'number literal');
assert.throws(TypeError, function() {
iter.call(null);
}, 'null');
assert.throws(TypeError, function() {
iter.call('string literal');
}, 'string literal');
assert.throws(TypeError, function() {
iter.call(Symbol.iterator);
}, 'symbol');

View File

@ -1,103 +0,0 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-@@iterator
description: Iteration over exported names
info: >
15.2.1.18 Runtime Semantics: GetModuleNamespace
[...]
3. If namespace is undefined, then
a. Let exportedNames be ? module.GetExportedNames(« »).
b. Let unambiguousNames be a new empty List.
c. For each name that is an element of exportedNames,
i. Let resolution be ? module.ResolveExport(name, « », « »).
ii. If resolution is null, throw a SyntaxError exception.
iii. If resolution is not "ambiguous", append name to
unambiguousNames.
d. Let namespace be ModuleNamespaceCreate(module, unambiguousNames).
4. Return namespace.
9.4.6.12 ModuleNamespaceCreate (module, exports)
[...]
7. Set M's [[Exports]] internal slot to exports.
[...]
26.3.2 [ @@iterator ] ( )
[...]
3. Let exports be the value of N's [[Exports]] internal slot.
4. Return ! CreateListIterator(exports).
Note: identifiers have been selected such that runtimes which do not sort
the [[Exports]] list may still pass. A separate test is dedicated to sort
order.
flags: [module]
features: [Symbol.iterator, let]
---*/
import * as ns from './values-binding-types.js';
export var a_local1;
var local2;
export { local2 as b_renamed };
export { a_local1 as e_indirect } from './values-binding-types.js';
export * from './values-binding-types_FIXTURE.js';
var iter = ns[Symbol.iterator]();
var result;
result = iter.next();
assert.sameValue(result.done, false, 'not initially done');
assert.sameValue(result.value, 'a_local1');
result = iter.next();
assert.sameValue(result.value, 'b_renamed');
assert.sameValue(result.done, false , 'not done after "a_local1"');
result = iter.next();
assert.sameValue(result.value, 'c_localUninit1');
assert.sameValue(result.done, false, 'not done after "b_renamed"');
result = iter.next();
assert.sameValue(result.value, 'd_renamedUninit');
assert.sameValue(result.done, false, 'not done after "c_localUninit1"');
result = iter.next();
assert.sameValue(result.value, 'default');
assert.sameValue(result.done, false, 'not done after "d_renamedUninit"');
result = iter.next();
assert.sameValue(result.value, 'e_indirect');
assert.sameValue(result.done, false, 'not done after "default"');
result = iter.next();
assert.sameValue(result.value, 'f_indirectUninit');
assert.sameValue(result.done, false, 'not done after "e_indirect"');
result = iter.next();
assert.sameValue(result.value, 'g_star');
assert.sameValue(result.done, false, 'not done after "f_indirectUninit"');
result = iter.next();
assert.sameValue(result.value, 'h_starRenamed');
assert.sameValue(result.done, false, 'not done after "g_star"');
result = iter.next();
assert.sameValue(result.value, 'i_starIndirect');
assert.sameValue(result.done, false, 'not done after "h_starRenamed"');
result = iter.next();
assert.sameValue(result.done, true, 'done after "i_starIndirect"');
assert.sameValue(result.value, undefined);
result = iter.next();
assert.sameValue(result.done, true, 'done after exhaustion');
assert.sameValue(result.value, undefined);
export let c_localUninit1;
let localUninit2;
export { localUninit2 as d_renamedUninit };
export { c_localUninit1 as f_indirectUninit } from './values-binding-types.js';
export default null;

View File

@ -1,7 +0,0 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
export var g_star;
export { g_star as h_starRenamed };
export { a_local1 as i_starIndirect } from './values-binding-types.js';

View File

@ -1,133 +0,0 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-@@iterator
description: Iteration order over exported names
info: >
Iteration should include all non-ambiguous export names ordered as if an
Array of those String values had been sorted using `Array.prototype.sort`
using SortCompare as *comparefunction*.
15.2.1.18 Runtime Semantics: GetModuleNamespace
[...]
3. If namespace is undefined, then
a. Let exportedNames be ? module.GetExportedNames(« »).
b. Let unambiguousNames be a new empty List.
c. For each name that is an element of exportedNames,
i. Let resolution be ? module.ResolveExport(name, « », « »).
ii. If resolution is null, throw a SyntaxError exception.
iii. If resolution is not "ambiguous", append name to
unambiguousNames.
d. Let namespace be ModuleNamespaceCreate(module, unambiguousNames).
4. Return namespace.
9.4.6.12 ModuleNamespaceCreate (module, exports)
[...]
7. Set M's [[Exports]] internal slot to exports.
[...]
26.3.2 [ @@iterator ] ( )
[...]
3. Let exports be the value of N's [[Exports]] internal slot.
4. Return ! CreateListIterator(exports).
flags: [module]
features: [Symbol.iterator]
---*/
var x;
export { x as π }; // u03c0
export { x as az };
export { x as __ };
export { x as za };
export { x as Z };
export { x as \u03bc };
export { x as z };
export { x as zz };
export { x as a };
export { x as A };
export { x as aa };
export { x as λ }; // u03bb
export { x as _ };
export { x as $$ };
export { x as $ };
export default null;
import * as ns from './values-order.js';
var iter = ns[Symbol.iterator]();
var result;
result = iter.next();
assert.sameValue(result.done, false, 'not initially done');
assert.sameValue(result.value, '$');
result = iter.next();
assert.sameValue(result.done, false, 'not done following "$"');
assert.sameValue(result.value, '$$');
result = iter.next();
assert.sameValue(result.done, false, 'not done following "$$"');
assert.sameValue(result.value, 'A');
result = iter.next();
assert.sameValue(result.done, false, 'not done following "A"');
assert.sameValue(result.value, 'Z');
result = iter.next();
assert.sameValue(result.done, false, 'not done following "Z"');
assert.sameValue(result.value, '_');
result = iter.next();
assert.sameValue(result.done, false, 'not done following "_"');
assert.sameValue(result.value, '__');
result = iter.next();
assert.sameValue(result.done, false, 'not done following "__"');
assert.sameValue(result.value, 'a');
result = iter.next();
assert.sameValue(result.done, false, 'not done following "a"');
assert.sameValue(result.value, 'aa');
result = iter.next();
assert.sameValue(result.done, false, 'not done following "aa"');
assert.sameValue(result.value, 'az');
result = iter.next();
assert.sameValue(result.done, false, 'not done following "az"');
assert.sameValue(result.value, 'default');
result = iter.next();
assert.sameValue(result.done, false, 'not done following "default"');
assert.sameValue(result.value, 'z');
result = iter.next();
assert.sameValue(result.done, false, 'not done following "z"');
assert.sameValue(result.value, 'za');
result = iter.next();
assert.sameValue(result.done, false, 'not done following "za"');
assert.sameValue(result.value, 'zz');
result = iter.next();
assert.sameValue(result.done, false, 'not done following "zz"');
assert.sameValue(result.value, '\u03bb');
result = iter.next();
assert.sameValue(result.done, false, 'not done following "\u03bb"');
assert.sameValue(result.value, '\u03bc');
result = iter.next();
assert.sameValue(result.done, false, 'not done following "\u03bc"');
assert.sameValue(result.value, '\u03c0');
result = iter.next();
assert.sameValue(result.done, true, 'done following "\u03c0"');
assert.sameValue(result.value, undefined);
result = iter.next();
assert.sameValue(result.done, true, 'done following exhaustion');
assert.sameValue(result.value, undefined);

View File

@ -7,7 +7,7 @@ description: >
info: |
1. Return false.
flags: [module]
features: [Reflect, Symbol.iterator, Symbol.toStringTag]
features: [Reflect, Symbol, Symbol.toStringTag]
---*/
import * as ns from './define-own-property.js';
@ -62,15 +62,6 @@ assert.throws(TypeError, function() {
Object.defineProperty(ns, 'default', {});
}, 'Object.defineProperty: default');
assert.sameValue(
Reflect.defineProperty(ns, Symbol.iterator, {}),
false,
'Reflect.defineProperty: Symbol.iterator'
);
assert.throws(TypeError, function() {
Object.defineProperty(ns, Symbol.iterator, {});
}, 'Object.defineProperty: Symbol.iterator');
assert.sameValue(
Reflect.defineProperty(ns, Symbol.toStringTag, {}),
false,

View File

@ -10,7 +10,7 @@ info: |
3. If P is an element of exports, return false.
4. Return true.
flags: [module]
features: [Reflect, Symbol, Symbol.iterator, Symbol.toStringTag]
features: [Reflect, Symbol, Symbol.toStringTag]
---*/
import * as ns from './delete-non-exported.js';
@ -24,12 +24,6 @@ assert(
Reflect.deleteProperty(ns, 'default'), 'Reflect.deleteProperty: default'
);
assert(delete ns[Symbol.iterator], 'delete: Symbol.iterator');
assert(
Reflect.deleteProperty(ns, Symbol.iterator),
'Reflect.deleteProperty: Symbol.iterator'
);
assert(delete ns[Symbol.toStringTag], 'delete: Symbol.toStringTag');
assert(
Reflect.deleteProperty(ns, Symbol.toStringTag),

View File

@ -5,22 +5,13 @@ esid: sec-module-namespace-exotic-objects-getownproperty-p
description: >
Behavior of the [[GetOwnProperty]] internal method with a Symbol argument
flags: [module]
features: [Symbol, Symbol.iterator, Symbol.toStringTag]
features: [Symbol, Symbol.toStringTag]
---*/
import * as ns from './get-own-property-sym.js';
var notFound = Symbol('test262');
var desc;
assert.sameValue(
Object.prototype.hasOwnProperty.call(ns, Symbol.iterator), true
);
desc = Object.getOwnPropertyDescriptor(ns, Symbol.iterator);
assert.sameValue(desc.value, ns[Symbol.iterator]);
assert.sameValue(desc.enumerable, false, 'Symbol.iterator enumerable');
assert.sameValue(desc.writable, true, 'Symbol.iterator writable');
assert.sameValue(desc.configurable, true, 'Symbol.iterator configurable');
assert.sameValue(
Object.prototype.hasOwnProperty.call(ns, Symbol.toStringTag), true
);

View File

@ -10,10 +10,9 @@ info: |
2. If Type(P) is Symbol, then
a. Return ? OrdinaryGet(O, P, Receiver).
flags: [module]
features: [Symbol.iterator, Symbol.toStringTag]
features: [Symbol.toStringTag]
---*/
import * as ns from './get-sym-found.js';
assert.sameValue(typeof ns[Symbol.iterator], 'function');
assert.sameValue(typeof ns[Symbol.toStringTag], 'string');

View File

@ -8,12 +8,10 @@ description: >
info: |
1. If Type(P) is Symbol, return OrdinaryHasProperty(O, P).
flags: [module]
features: [Symbol.iterator, Symbol.toStringTag, Reflect]
features: [Symbol.toStringTag, Reflect]
---*/
import * as ns from './has-property-sym-found.js';
assert(Symbol.iterator in ns, 'in: Symbol.iterator');
assert(Reflect.has(ns, Symbol.iterator), 'Reflect.has: Symbol.iterator');
assert(Symbol.toStringTag in ns, 'in: Symbol.toStringTag');
assert(Reflect.has(ns, Symbol.toStringTag), 'Reflect.has: Symbol.toStringTag');

View File

@ -15,7 +15,7 @@ info: |
the [[Exports]] list may still pass. A separate test is dedicated to sort
order.
flags: [module]
features: [Reflect, Symbol.iterator, Symbol.toStringTag, let]
features: [Reflect, Symbol.toStringTag, let]
---*/
import * as ns from './own-property-keys-binding-types.js';
@ -42,13 +42,9 @@ assert.sameValue(stringKeys[9], 'i_starIndirect');
var symbolKeys = Object.getOwnPropertySymbols(ns);
assert(
symbolKeys.length > 1,
symbolKeys.length > 0,
'at least as many Symbol keys as defined by the specification'
);
assert(
symbolKeys.indexOf(Symbol.iterator) > -1,
'Symbol keys array includes Symbol.iterator'
);
assert(
symbolKeys.indexOf(Symbol.toStringTag) > -1,
'Symbol keys array includes Symbol.toStringTag'
@ -70,9 +66,6 @@ assert.sameValue(allKeys[6], 'f_indirectUninit');
assert.sameValue(allKeys[7], 'g_star');
assert.sameValue(allKeys[8], 'h_starRenamed');
assert.sameValue(allKeys[9], 'i_starIndirect');
assert(
allKeys.indexOf(Symbol.iterator) > 9, 'keys array includes Symbol.iterator'
);
assert(
allKeys.indexOf(Symbol.toStringTag) > 9,
'keys array includes Symbol.toStringTag'

View File

@ -10,7 +10,7 @@ info: |
3. Append all the entries of symbolKeys to the end of exports.
4. Return exports.
flags: [module]
features: [Reflect, Symbol.iterator, Symbol.toStringTag]
features: [Reflect, Symbol.toStringTag]
---*/
var x;
@ -74,9 +74,6 @@ assert.sameValue(allKeys[12], 'zz', 'allKeys[12] === "zz"');
assert.sameValue(allKeys[13], '\u03bb', 'allKeys[13] === "\u03bb"');
assert.sameValue(allKeys[14], '\u03bc', 'allKeys[14] === "\u03bc"');
assert.sameValue(allKeys[15], '\u03c0', 'allKeys[15] === "\u03c0"');
assert(
allKeys.indexOf(Symbol.iterator) > 15, 'keys array includes Symbol.iterator'
);
assert(
allKeys.indexOf(Symbol.toStringTag) > 15,
'keys array includes Symbol.toStringTag'

View File

@ -6,7 +6,7 @@ description: The [[Set]] internal method consistently returns `false`
info: |
1. Return false.
flags: [module]
features: [Reflect, Symbol.iterator, Symbol.toStringTag]
features: [Reflect, Symbol, Symbol.toStringTag]
---*/
import * as ns from './define-own-property.js';
@ -41,13 +41,6 @@ assert.throws(TypeError, function() {
ns.default = null;
}, 'AssignmentExpression: default');
assert.sameValue(
Reflect.set(ns, Symbol.iterator), false, 'Reflect.set: Symbol.iterator'
);
assert.throws(TypeError, function() {
ns[Symbol.iterator] = null;
}, 'AssignmentExpression: Symbol.iterator');
assert.sameValue(
Reflect.set(ns, Symbol.toStringTag),
false,