mirror of
https://github.com/tc39/test262.git
synced 2025-07-26 07:25:15 +02:00
parent
e223738369
commit
63c1f1ca88
@ -1,37 +0,0 @@
|
|||||||
// Copyright (C) 2015 Leonardo Balter. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
/*---
|
|
||||||
es6id: 26.1.5
|
|
||||||
description: >
|
|
||||||
Returned iterator does not iterate over symbol properties.
|
|
||||||
info: >
|
|
||||||
26.1.5 Reflect.enumerate ( target )
|
|
||||||
|
|
||||||
...
|
|
||||||
2. Return target.[[Enumerate]]().
|
|
||||||
features: [Symbol]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
var iter, step;
|
|
||||||
var s = Symbol('1');
|
|
||||||
|
|
||||||
var o = {
|
|
||||||
'a': 1,
|
|
||||||
'b': 1
|
|
||||||
};
|
|
||||||
|
|
||||||
o[s] = 1;
|
|
||||||
|
|
||||||
iter = Reflect.enumerate(o);
|
|
||||||
|
|
||||||
step = iter.next();
|
|
||||||
assert.sameValue(step.value, 'a');
|
|
||||||
assert.sameValue(step.done, false);
|
|
||||||
|
|
||||||
step = iter.next();
|
|
||||||
assert.sameValue(step.value, 'b');
|
|
||||||
assert.sameValue(step.done, false);
|
|
||||||
|
|
||||||
step = iter.next();
|
|
||||||
assert.sameValue(step.value, undefined);
|
|
||||||
assert.sameValue(step.done, true);
|
|
@ -1,17 +0,0 @@
|
|||||||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
/*---
|
|
||||||
es6id: 26.1.5
|
|
||||||
description: >
|
|
||||||
Reflect.enumerate is configurable, writable and not enumerable.
|
|
||||||
info: >
|
|
||||||
26.1.5 Reflect.enumerate ( target )
|
|
||||||
|
|
||||||
17 ECMAScript Standard Built-in Objects
|
|
||||||
|
|
||||||
includes: [propertyHelper.js]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
verifyNotEnumerable(Reflect, 'enumerate');
|
|
||||||
verifyWritable(Reflect, 'enumerate');
|
|
||||||
verifyConfigurable(Reflect, 'enumerate');
|
|
@ -1,17 +0,0 @@
|
|||||||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
/*---
|
|
||||||
es6id: 26.1.5
|
|
||||||
description: >
|
|
||||||
Reflect.enumerate.length value and property descriptor
|
|
||||||
includes: [propertyHelper.js]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
assert.sameValue(
|
|
||||||
Reflect.enumerate.length, 1,
|
|
||||||
'The value of `Reflect.enumerate.length` is `1`'
|
|
||||||
);
|
|
||||||
|
|
||||||
verifyNotEnumerable(Reflect.enumerate, 'length');
|
|
||||||
verifyNotWritable(Reflect.enumerate, 'length');
|
|
||||||
verifyConfigurable(Reflect.enumerate, 'length');
|
|
@ -1,22 +0,0 @@
|
|||||||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
/*---
|
|
||||||
es6id: 26.1.5
|
|
||||||
description: >
|
|
||||||
Reflect.enumerate.name value and property descriptor
|
|
||||||
info: >
|
|
||||||
26.1.5 Reflect.enumerate ( target )
|
|
||||||
|
|
||||||
17 ECMAScript Standard Built-in Objects
|
|
||||||
|
|
||||||
includes: [propertyHelper.js]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
assert.sameValue(
|
|
||||||
Reflect.enumerate.name, 'enumerate',
|
|
||||||
'The value of `Reflect.enumerate.name` is `"enumerate"`'
|
|
||||||
);
|
|
||||||
|
|
||||||
verifyNotEnumerable(Reflect.enumerate, 'name');
|
|
||||||
verifyNotWritable(Reflect.enumerate, 'name');
|
|
||||||
verifyConfigurable(Reflect.enumerate, 'name');
|
|
@ -1,24 +0,0 @@
|
|||||||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
/*---
|
|
||||||
es6id: 26.1.5
|
|
||||||
description: >
|
|
||||||
Return abrupt result.
|
|
||||||
info: >
|
|
||||||
26.1.5 Reflect.enumerate ( target )
|
|
||||||
|
|
||||||
...
|
|
||||||
2. Return target.[[Enumerate]]().
|
|
||||||
features: [Proxy]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
var o = {};
|
|
||||||
var p = new Proxy(o, {
|
|
||||||
enumerate: function() {
|
|
||||||
throw new Test262Error();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
assert.throws(Test262Error, function() {
|
|
||||||
Reflect.enumerate(p);
|
|
||||||
});
|
|
@ -1,62 +0,0 @@
|
|||||||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
/*---
|
|
||||||
es6id: 26.1.5
|
|
||||||
description: >
|
|
||||||
Return an iterator.
|
|
||||||
info: >
|
|
||||||
26.1.5 Reflect.enumerate ( target )
|
|
||||||
|
|
||||||
...
|
|
||||||
2. Return target.[[Enumerate]]().
|
|
||||||
---*/
|
|
||||||
|
|
||||||
var iter, step;
|
|
||||||
var arr = ['a', 'b', 'c'];
|
|
||||||
|
|
||||||
iter = Reflect.enumerate(arr);
|
|
||||||
|
|
||||||
step = iter.next();
|
|
||||||
assert.sameValue(step.value, '0');
|
|
||||||
assert.sameValue(step.done, false);
|
|
||||||
|
|
||||||
step = iter.next();
|
|
||||||
assert.sameValue(step.value, '1');
|
|
||||||
assert.sameValue(step.done, false);
|
|
||||||
|
|
||||||
step = iter.next();
|
|
||||||
assert.sameValue(step.value, '2');
|
|
||||||
assert.sameValue(step.done, false);
|
|
||||||
|
|
||||||
step = iter.next();
|
|
||||||
assert.sameValue(step.value, undefined);
|
|
||||||
assert.sameValue(step.done, true);
|
|
||||||
|
|
||||||
var o = {
|
|
||||||
'a': 42,
|
|
||||||
'b': 43,
|
|
||||||
'c': 44
|
|
||||||
};
|
|
||||||
|
|
||||||
Object.defineProperty(o, 'd', {
|
|
||||||
enumerable: false,
|
|
||||||
value: 45
|
|
||||||
});
|
|
||||||
|
|
||||||
iter = Reflect.enumerate(o);
|
|
||||||
|
|
||||||
step = iter.next();
|
|
||||||
assert.sameValue(step.value, 'a');
|
|
||||||
assert.sameValue(step.done, false);
|
|
||||||
|
|
||||||
step = iter.next();
|
|
||||||
assert.sameValue(step.value, 'b');
|
|
||||||
assert.sameValue(step.done, false);
|
|
||||||
|
|
||||||
step = iter.next();
|
|
||||||
assert.sameValue(step.value, 'c');
|
|
||||||
assert.sameValue(step.done, false);
|
|
||||||
|
|
||||||
step = iter.next();
|
|
||||||
assert.sameValue(step.value, undefined);
|
|
||||||
assert.sameValue(step.done, true);
|
|
@ -1,28 +0,0 @@
|
|||||||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
/*---
|
|
||||||
es6id: 26.1.5
|
|
||||||
description: >
|
|
||||||
Throws a TypeError if target is not an Object.
|
|
||||||
info: >
|
|
||||||
26.1.5 Reflect.enumerate ( target )
|
|
||||||
|
|
||||||
1. If Type(target) is not Object, throw a TypeError exception.
|
|
||||||
...
|
|
||||||
---*/
|
|
||||||
|
|
||||||
assert.throws(TypeError, function() {
|
|
||||||
Reflect.enumerate(1);
|
|
||||||
});
|
|
||||||
|
|
||||||
assert.throws(TypeError, function() {
|
|
||||||
Reflect.enumerate(null);
|
|
||||||
});
|
|
||||||
|
|
||||||
assert.throws(TypeError, function() {
|
|
||||||
Reflect.enumerate(undefined);
|
|
||||||
});
|
|
||||||
|
|
||||||
assert.throws(TypeError, function() {
|
|
||||||
Reflect.enumerate('');
|
|
||||||
});
|
|
@ -1,17 +0,0 @@
|
|||||||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
/*---
|
|
||||||
es6id: 26.1.5
|
|
||||||
description: >
|
|
||||||
Throws a TypeError if target is a Symbol
|
|
||||||
info: >
|
|
||||||
26.1.5 Reflect.enumerate ( target )
|
|
||||||
|
|
||||||
1. If Type(target) is not Object, throw a TypeError exception.
|
|
||||||
...
|
|
||||||
features: [Symbol]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
assert.throws(TypeError, function() {
|
|
||||||
Reflect.enumerate(Symbol(1), 'p');
|
|
||||||
});
|
|
Loading…
x
Reference in New Issue
Block a user