mirror of https://github.com/tc39/test262.git
commit
ddc687d0cb
|
@ -0,0 +1,25 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.1.1
|
||||
description: >
|
||||
Throws TypeError if add is not callable on constructor call.
|
||||
info: >
|
||||
23.4.1.1 WeakSet ( [ iterable ] )
|
||||
|
||||
...
|
||||
5. If iterable is not present, let iterable be undefined.
|
||||
6. If iterable is either undefined or null, let iter be undefined.
|
||||
7. Else,
|
||||
a. Let adder be Get(set, "add").
|
||||
b. ReturnIfAbrupt(adder).
|
||||
c. If IsCallable(adder) is false, throw a TypeError exception.
|
||||
...
|
||||
---*/
|
||||
|
||||
WeakSet.prototype.add = null;
|
||||
new WeakSet();
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
new WeakSet([]);
|
||||
});
|
|
@ -0,0 +1,13 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.1
|
||||
description: >
|
||||
The WeakSet constructor is the %WeakSet% intrinsic object and the initial
|
||||
value of the WeakSet property of the global object.
|
||||
---*/
|
||||
|
||||
assert.sameValue(
|
||||
typeof WeakSet, 'function',
|
||||
'typeof WeakSet is "function"'
|
||||
);
|
|
@ -0,0 +1,31 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.1.1
|
||||
description: >
|
||||
If the iterable argument is empty, return new Weakset object.
|
||||
info: >
|
||||
23.4.1.1 WeakSet ( [ iterable ] )
|
||||
|
||||
...
|
||||
9. Repeat
|
||||
a. Let next be IteratorStep(iter).
|
||||
b. ReturnIfAbrupt(next).
|
||||
c. If next is false, return set.
|
||||
...
|
||||
---*/
|
||||
|
||||
var counter = 0;
|
||||
var add = WeakSet.prototype.add;
|
||||
WeakSet.prototype.add = function(value) {
|
||||
counter++;
|
||||
return add.call(this, value);
|
||||
};
|
||||
var set = new WeakSet([]);
|
||||
|
||||
assert.sameValue(Object.getPrototypeOf(set), WeakSet.prototype);
|
||||
assert(set instanceof WeakSet);
|
||||
assert.sameValue(
|
||||
counter, 0,
|
||||
'empty iterable does not call WeakSet.prototype.add'
|
||||
);
|
|
@ -0,0 +1,30 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.1.1
|
||||
description: >
|
||||
Return abrupt after getting `add` method.
|
||||
info: >
|
||||
23.4.1.1 WeakSet ( [ iterable ] )
|
||||
|
||||
...
|
||||
5. If iterable is not present, let iterable be undefined.
|
||||
6. If iterable is either undefined or null, let iter be undefined.
|
||||
7. Else,
|
||||
a. Let adder be Get(set, "add").
|
||||
b. ReturnIfAbrupt(adder).
|
||||
...
|
||||
---*/
|
||||
|
||||
Object.defineProperty(WeakSet.prototype, 'add', {
|
||||
get: function() {
|
||||
throw new Test262Error();
|
||||
}
|
||||
});
|
||||
|
||||
new WeakSet();
|
||||
new WeakSet(null);
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
new WeakSet([]);
|
||||
});
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.1.1
|
||||
description: >
|
||||
If the iterable argument is undefined, return new Weakset object.
|
||||
info: >
|
||||
23.4.1.1 WeakSet ( [ iterable ] )
|
||||
|
||||
...
|
||||
7. Else,
|
||||
d. Let iter be GetIterator(iterable).
|
||||
e. ReturnIfAbrupt(iter).
|
||||
...
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
new WeakSet({});
|
||||
});
|
|
@ -0,0 +1,29 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.1.1
|
||||
description: >
|
||||
Returns the new WeakSet adding the objects from the iterable parameter.
|
||||
info: >
|
||||
WeakSet ( [ iterable ] )
|
||||
|
||||
...
|
||||
9. Repeat
|
||||
f. Let status be Call(adder, set, «nextValue»).
|
||||
g. If status is an abrupt completion, return IteratorClose(iter, status).
|
||||
includes: [compareArray.js]
|
||||
---*/
|
||||
|
||||
var first = {};
|
||||
var second = {};
|
||||
var added = [];
|
||||
var add = WeakSet.prototype.add;
|
||||
WeakSet.prototype.add = function(value) {
|
||||
added.push(value);
|
||||
return add.call(this, value);
|
||||
};
|
||||
var s = new WeakSet([first, second]);
|
||||
|
||||
assert.sameValue(added.length, 2, 'Called WeakSet#add for each object');
|
||||
assert.sameValue(added[0], first, 'Adds object in order - first');
|
||||
assert.sameValue(added[1], second, 'Adds object in order - second');
|
|
@ -0,0 +1,37 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.1.1
|
||||
description: >
|
||||
Return IteratorClose(iter, status) if fail on adding value on constructing.
|
||||
info: >
|
||||
WeakSet ( [ iterable ] )
|
||||
|
||||
...
|
||||
9. Repeat
|
||||
f. Let status be Call(adder, set, «nextValue»).
|
||||
g. If status is an abrupt completion, return IteratorClose(iter, status).
|
||||
---*/
|
||||
|
||||
var count = 0;
|
||||
var iterable = {};
|
||||
iterable[Symbol.iterator] = function() {
|
||||
return {
|
||||
next: function() {
|
||||
return { value: null, done: false };
|
||||
},
|
||||
return: function() {
|
||||
count += 1;
|
||||
}
|
||||
};
|
||||
};
|
||||
WeakSet.prototype.add = function() { throw new Test262Error(); };
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
new WeakSet(iterable);
|
||||
});
|
||||
|
||||
assert.sameValue(
|
||||
count, 1,
|
||||
'The iterator is closed when `WeakSet.prototype.add` throws an error.'
|
||||
);
|
|
@ -0,0 +1,28 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.1.1
|
||||
description: >
|
||||
Return abrupt from next iterator step.
|
||||
info: >
|
||||
23.4.1.1 WeakSet ( [ iterable ] )
|
||||
|
||||
...
|
||||
9. Repeat
|
||||
a. Let next be IteratorStep(iter).
|
||||
b. ReturnIfAbrupt(next).
|
||||
...
|
||||
---*/
|
||||
|
||||
var iterable = {};
|
||||
iterable[Symbol.iterator] = function() {
|
||||
return {
|
||||
next: function() {
|
||||
throw new Test262Error();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
new WeakSet(iterable);
|
||||
});
|
|
@ -0,0 +1,34 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.1.1
|
||||
description: >
|
||||
If the iterable argument is empty, return new Weakset object.
|
||||
info: >
|
||||
23.4.1.1 WeakSet ( [ iterable ] )
|
||||
|
||||
...
|
||||
9. Repeat
|
||||
...
|
||||
d. Let nextValue be IteratorValue(next).
|
||||
e. ReturnIfAbrupt(nextValue).
|
||||
---*/
|
||||
|
||||
var count = 0;
|
||||
var iterable = {};
|
||||
iterable[Symbol.iterator] = function() {
|
||||
return {
|
||||
next: function() {
|
||||
return {
|
||||
get value() {
|
||||
throw new Test262Error();
|
||||
},
|
||||
done: false
|
||||
};
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
new WeakSet(iterable);
|
||||
});
|
|
@ -0,0 +1,14 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.2
|
||||
description: >
|
||||
The length property of the WeakSet constructor is 0.
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
assert.sameValue(WeakSet.length, 0, 'The value of `WeakSet.length` is `0`');
|
||||
|
||||
verifyNotEnumerable(WeakSet, 'length');
|
||||
verifyNotWritable(WeakSet, 'length');
|
||||
verifyConfigurable(WeakSet, 'length');
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.1.1
|
||||
description: >
|
||||
WeakSet ( [ iterable ] )
|
||||
|
||||
17 ECMAScript Standard Built-in Objects
|
||||
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
assert.sameValue(
|
||||
WeakSet.name, 'WeakSet',
|
||||
'The value of `WeakSet.name` is "WeakSet"'
|
||||
);
|
||||
|
||||
verifyNotEnumerable(WeakSet, 'name');
|
||||
verifyNotWritable(WeakSet, 'name');
|
||||
verifyConfigurable(WeakSet, 'name');
|
|
@ -0,0 +1,24 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.1.1
|
||||
description: >
|
||||
If the iterable argument is undefined, return new Weakset object.
|
||||
info: >
|
||||
23.4.1.1 WeakSet ( [ iterable ] )
|
||||
|
||||
...
|
||||
5. If iterable is not present, let iterable be undefined.
|
||||
6. If iterable is either undefined or null, let iter be undefined.
|
||||
...
|
||||
8. If iter is undefined, return set.
|
||||
...
|
||||
---*/
|
||||
|
||||
var a = new WeakSet();
|
||||
var b = new WeakSet(undefined);
|
||||
var c = new WeakSet(null);
|
||||
|
||||
assert.sameValue(Object.getPrototypeOf(a), WeakSet.prototype);
|
||||
assert.sameValue(Object.getPrototypeOf(b), WeakSet.prototype);
|
||||
assert.sameValue(Object.getPrototypeOf(c), WeakSet.prototype);
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3
|
||||
description: >
|
||||
The WeakSet.prototype's prototype is Object.prototype.
|
||||
info: >
|
||||
23.4.3 Properties of the WeakSet Prototype Object
|
||||
|
||||
The WeakSet prototype object is the intrinsic object %WeakSetPrototype%. The
|
||||
value of the [[Prototype]] internal slot of the WeakSet prototype object is
|
||||
the intrinsic object %ObjectPrototype% (19.1.3). The WeakSet prototype
|
||||
object is an ordinary object. It does not have a [[WeakSetData]] internal
|
||||
slot.
|
||||
---*/
|
||||
|
||||
assert.sameValue(
|
||||
Object.getPrototypeOf(WeakSet.prototype),
|
||||
Object.prototype,
|
||||
'`Object.getPrototypeOf(WeakSet.prototype)` returns `Object.prototype`'
|
||||
);
|
|
@ -0,0 +1,14 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.2
|
||||
description: >
|
||||
The value of the [[Prototype]] internal slot of the WeakSet constructor
|
||||
is the intrinsic object %FunctionPrototype% (19.2.3).
|
||||
---*/
|
||||
|
||||
assert.sameValue(
|
||||
Object.getPrototypeOf(WeakSet),
|
||||
Function.prototype,
|
||||
'`Object.getPrototypeOf(WeakSet)` returns `Function.prototype`'
|
||||
);
|
|
@ -0,0 +1,27 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.5
|
||||
description: "WeakSet#@@toStringTag value and writability"
|
||||
info: >
|
||||
23.4.3.5 WeakSet.prototype [ @@toStringTag ]
|
||||
|
||||
The initial value of the @@toStringTag property is the string value
|
||||
"WeakSet".
|
||||
|
||||
This property has the attributes { [[Writable]]: false, [[Enumerable]]:
|
||||
false, [[Configurable]]: true }.
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var WeakSetProto = WeakSet.prototype;
|
||||
|
||||
assert.sameValue(
|
||||
WeakSetProto[Symbol.toStringTag],
|
||||
'WeakSet',
|
||||
'The value of WeakSet.prototype[Symbol.toStringTag] is "WeakSet"'
|
||||
);
|
||||
|
||||
verifyNotEnumerable(WeakSetProto, Symbol.toStringTag);
|
||||
verifyNotWritable(WeakSetProto, Symbol.toStringTag);
|
||||
verifyConfigurable(WeakSetProto, Symbol.toStringTag);
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.1
|
||||
description: WeakSet.prototype.add property descriptor
|
||||
info: >
|
||||
WeakSet.prototype.add ( value )
|
||||
|
||||
17 ECMAScript Standard Built-in Objects
|
||||
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
assert.sameValue(
|
||||
typeof WeakSet.prototype.add,
|
||||
'function',
|
||||
'typeof WeakSet.prototype.add is "function"'
|
||||
);
|
||||
|
||||
verifyNotEnumerable(WeakSet.prototype, 'add');
|
||||
verifyWritable(WeakSet.prototype, 'add');
|
||||
verifyConfigurable(WeakSet.prototype, 'add');
|
|
@ -0,0 +1,26 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.1
|
||||
description: >
|
||||
Appends value as the last element of entries.
|
||||
info: >
|
||||
WeakSet.prototype.add ( value )
|
||||
|
||||
...
|
||||
7. Append value as the last element of entries.
|
||||
...
|
||||
---*/
|
||||
|
||||
var s = new WeakSet();
|
||||
var foo = {};
|
||||
var bar = {};
|
||||
var baz = {};
|
||||
|
||||
s.add(foo);
|
||||
s.add(bar);
|
||||
s.add(baz);
|
||||
|
||||
assert(s.has(foo));
|
||||
assert(s.has(bar));
|
||||
assert(s.has(baz));
|
24
test/built-ins/WeakSet/prototype/add/does-not-have-weaksetdata-internal-slot-array.js
vendored
Normal file
24
test/built-ins/WeakSet/prototype/add/does-not-have-weaksetdata-internal-slot-array.js
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.1
|
||||
description: >
|
||||
Throws TypeError if context doesn't have a [[WeakSetData]] internal slot.
|
||||
info: >
|
||||
WeakSet.prototype.add ( value )
|
||||
|
||||
...
|
||||
3. If S does not have a [[WeakSetData]] internal slot, throw a TypeError
|
||||
exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
WeakSet.prototype.add.call([], {});
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
var s = new WeakSet();
|
||||
s.add.call([], {});
|
||||
});
|
24
test/built-ins/WeakSet/prototype/add/does-not-have-weaksetdata-internal-slot-map.js
vendored
Normal file
24
test/built-ins/WeakSet/prototype/add/does-not-have-weaksetdata-internal-slot-map.js
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.1
|
||||
description: >
|
||||
Throws TypeError if context doesn't have a [[WeakSetData]] internal slot.
|
||||
info: >
|
||||
WeakSet.prototype.add ( value )
|
||||
|
||||
...
|
||||
3. If S does not have a [[WeakSetData]] internal slot, throw a TypeError
|
||||
exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
WeakSet.prototype.add.call(new Map(), {});
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
var s = new WeakSet();
|
||||
s.add.call(new Map(), {});
|
||||
});
|
24
test/built-ins/WeakSet/prototype/add/does-not-have-weaksetdata-internal-slot-object.js
vendored
Normal file
24
test/built-ins/WeakSet/prototype/add/does-not-have-weaksetdata-internal-slot-object.js
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.1
|
||||
description: >
|
||||
Throws TypeError if context doesn't have a [[WeakSetData]] internal slot.
|
||||
info: >
|
||||
WeakSet.prototype.add ( value )
|
||||
|
||||
...
|
||||
3. If S does not have a [[WeakSetData]] internal slot, throw a TypeError
|
||||
exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
WeakSet.prototype.add.call({}, {});
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
var s = new WeakSet();
|
||||
s.add.call({}, {});
|
||||
});
|
24
test/built-ins/WeakSet/prototype/add/does-not-have-weaksetdata-internal-slot-set.js
vendored
Normal file
24
test/built-ins/WeakSet/prototype/add/does-not-have-weaksetdata-internal-slot-set.js
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.1
|
||||
description: >
|
||||
Throws TypeError if context doesn't have a [[WeakSetData]] internal slot.
|
||||
info: >
|
||||
WeakSet.prototype.add ( value )
|
||||
|
||||
...
|
||||
3. If S does not have a [[WeakSetData]] internal slot, throw a TypeError
|
||||
exception.
|
||||
...
|
||||
features: [Set]
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
WeakSet.prototype.add.call(new Set(), {});
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
var s = new WeakSet();
|
||||
s.add.call(new Set(), {});
|
||||
});
|
|
@ -0,0 +1,24 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.1
|
||||
description: >
|
||||
Throws TypeError if context doesn't have a [[WeakSetData]] internal slot.
|
||||
info: >
|
||||
WeakSet.prototype.add ( value )
|
||||
|
||||
...
|
||||
3. If S does not have a [[WeakSetData]] internal slot, throw a TypeError
|
||||
exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
WeakSet.prototype.add.call(WeakSet.prototype, {});
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
var s = new WeakSet();
|
||||
s.add.call(WeakSet.prototype, {});
|
||||
});
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.1
|
||||
description: WeakSet.prototype.add.length descriptor
|
||||
info: >
|
||||
WeakSet.prototype.add ( value )
|
||||
|
||||
17 ECMAScript Standard Built-in Objects
|
||||
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
assert.sameValue(
|
||||
WeakSet.prototype.add.length, 1,
|
||||
'The value of `WeakSet.prototype.add.length` is `1`'
|
||||
);
|
||||
|
||||
verifyNotEnumerable(WeakSet.prototype.add, 'length');
|
||||
verifyNotWritable(WeakSet.prototype.add, 'length');
|
||||
verifyConfigurable(WeakSet.prototype.add, 'length');
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.1
|
||||
description: WeakSet.prototype.add.name descriptor
|
||||
info: >
|
||||
WeakSet.prototype.add ( value )
|
||||
|
||||
17 ECMAScript Standard Built-in Objects
|
||||
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
assert.sameValue(
|
||||
WeakSet.prototype.add.name, 'add',
|
||||
'The value of WeakSet.prototype.add.name is "add"'
|
||||
);
|
||||
|
||||
verifyNotEnumerable(WeakSet.prototype.add, 'name');
|
||||
verifyNotWritable(WeakSet.prototype.add, 'name');
|
||||
verifyConfigurable(WeakSet.prototype.add, 'name');
|
20
test/built-ins/WeakSet/prototype/add/returns-this-when-ignoring-duplicate.js
vendored
Normal file
20
test/built-ins/WeakSet/prototype/add/returns-this-when-ignoring-duplicate.js
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.1
|
||||
description: Returns `this` when new value is duplicate.
|
||||
info: >
|
||||
WeakSet.prototype.add ( value )
|
||||
|
||||
1. Let S be this value.
|
||||
...
|
||||
6. Repeat for each e that is an element of entries,
|
||||
a. If e is not empty and SameValueZero(e, value) is true, then
|
||||
i. Return S.
|
||||
...
|
||||
---*/
|
||||
|
||||
var foo = {};
|
||||
var s = new WeakSet([foo]);
|
||||
|
||||
assert.sameValue(s.add(foo), s, '`s.add(foo)` returns `s`');
|
|
@ -0,0 +1,17 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.1
|
||||
description: Returns `this` after adding a new value.
|
||||
info: >
|
||||
WeakSet.prototype.add ( value )
|
||||
|
||||
1. Let S be this value.
|
||||
...
|
||||
8. Return S.
|
||||
|
||||
---*/
|
||||
|
||||
var s = new WeakSet();
|
||||
|
||||
assert.sameValue(s.add({}), s, '`s.add({})` returns `s`');
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.1
|
||||
description: Throws TypeError if `this` is not Object.
|
||||
info: >
|
||||
WeakSet.prototype.add ( value )
|
||||
|
||||
1. Let S be the this value.
|
||||
2. If Type(S) is not Object, throw a TypeError exception.
|
||||
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
WeakSet.prototype.add.call(false, {});
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
var s = new WeakSet();
|
||||
s.add.call(false, {});
|
||||
});
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.1
|
||||
description: Throws TypeError if `this` is not Object.
|
||||
info: >
|
||||
WeakSet.prototype.add ( value )
|
||||
|
||||
1. Let S be the this value.
|
||||
2. If Type(S) is not Object, throw a TypeError exception.
|
||||
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
WeakSet.prototype.add.call(null, {});
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
var s = new WeakSet();
|
||||
s.add.call(null, {});
|
||||
});
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.1
|
||||
description: Throws TypeError if `this` is not Object.
|
||||
info: >
|
||||
WeakSet.prototype.add ( value )
|
||||
|
||||
1. Let S be the this value.
|
||||
2. If Type(S) is not Object, throw a TypeError exception.
|
||||
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
WeakSet.prototype.add.call(0, {});
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
var s = new WeakSet();
|
||||
s.add.call(0, {});
|
||||
});
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.1
|
||||
description: Throws TypeError if `this` is not Object.
|
||||
info: >
|
||||
WeakSet.prototype.add ( value )
|
||||
|
||||
1. Let S be the this value.
|
||||
2. If Type(S) is not Object, throw a TypeError exception.
|
||||
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
WeakSet.prototype.add.call('', {});
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
var s = new WeakSet();
|
||||
s.add.call('', {});
|
||||
});
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.1
|
||||
description: Throws TypeError if `this` is not Object.
|
||||
info: >
|
||||
WeakSet.prototype.add ( value )
|
||||
|
||||
1. Let S be the this value.
|
||||
2. If Type(S) is not Object, throw a TypeError exception.
|
||||
features: [Symbol]
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
WeakSet.prototype.add.call(Symbol(), {});
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
var s = new WeakSet();
|
||||
s.add.call(Symbol(), {});
|
||||
});
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.1
|
||||
description: Throws TypeError if `this` is not Object.
|
||||
info: >
|
||||
WeakSet.prototype.add ( value )
|
||||
|
||||
1. Let S be the this value.
|
||||
2. If Type(S) is not Object, throw a TypeError exception.
|
||||
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
WeakSet.prototype.add.call(undefined, {});
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
var s = new WeakSet();
|
||||
s.add.call(undefined, {});
|
||||
});
|
|
@ -0,0 +1,37 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.1
|
||||
description: Throws TypeError if `value` is not Object.
|
||||
info: >
|
||||
WeakSet.prototype.add ( value )
|
||||
|
||||
4. If Type(value) is not Object, throw a TypeError exception.
|
||||
features: [Symbol]
|
||||
---*/
|
||||
|
||||
var s = new WeakSet();
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
s.add(1);
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
s.add(false);
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
s.add();
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
s.add('string');
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
s.add(null);
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
s.add(Symbol());
|
||||
});
|
14
test/built-ins/WeakSet/prototype/constructor/weakset-prototype-constructor-intrinsic.js
vendored
Normal file
14
test/built-ins/WeakSet/prototype/constructor/weakset-prototype-constructor-intrinsic.js
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.2
|
||||
description: >
|
||||
The initial value of WeakSet.prototype.constructor is the %WeakSet%
|
||||
intrinsic object.
|
||||
---*/
|
||||
|
||||
assert.sameValue(
|
||||
WeakSet.prototype.constructor,
|
||||
WeakSet,
|
||||
'The value of WeakSet.prototype.constructor is "WeakSet"'
|
||||
);
|
17
test/built-ins/WeakSet/prototype/constructor/weakset-prototype-constructor.js
vendored
Normal file
17
test/built-ins/WeakSet/prototype/constructor/weakset-prototype-constructor.js
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.2
|
||||
description: >
|
||||
WeakSet.prototype.constructor property descriptor
|
||||
info: >
|
||||
WeakSet ( [ iterable ] )
|
||||
|
||||
17 ECMAScript Standard Built-in Objects
|
||||
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
verifyNotEnumerable(WeakSet.prototype, 'constructor');
|
||||
verifyWritable(WeakSet.prototype, 'constructor');
|
||||
verifyConfigurable(WeakSet.prototype, 'constructor');
|
|
@ -0,0 +1,27 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.3
|
||||
description: >
|
||||
Delete an entry from initial iterable.
|
||||
info: >
|
||||
WeakSet.prototype.delete ( value )
|
||||
|
||||
...
|
||||
5. Let entries be the List that is the value of S’s [[WeakSetData]] internal
|
||||
slot.
|
||||
6. Repeat for each e that is an element of entries,
|
||||
a. If e is not empty and SameValue(e, value) is true, then
|
||||
i. Replace the element of entries whose value is e with an element whose
|
||||
value is empty.
|
||||
ii. Return true.
|
||||
...
|
||||
---*/
|
||||
|
||||
var foo = {};
|
||||
var s = new WeakSet([foo]);
|
||||
|
||||
var result = s.delete(foo);
|
||||
|
||||
assert.sameValue(s.has(foo), false);
|
||||
assert.sameValue(result, true, 'WeakSet#delete returns true');
|
|
@ -0,0 +1,30 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.3
|
||||
description: >
|
||||
Delete an entry.
|
||||
info: >
|
||||
WeakSet.prototype.delete ( value )
|
||||
|
||||
...
|
||||
5. Let entries be the List that is the value of S’s [[WeakSetData]] internal
|
||||
slot.
|
||||
6. Repeat for each e that is an element of entries,
|
||||
a. If e is not empty and SameValue(e, value) is true, then
|
||||
i. Replace the element of entries whose value is e with an element whose
|
||||
value is empty.
|
||||
ii. Return true.
|
||||
...
|
||||
|
||||
---*/
|
||||
|
||||
var foo = {};
|
||||
var s = new WeakSet();
|
||||
|
||||
s.add(foo);
|
||||
|
||||
var result = s.delete(foo);
|
||||
|
||||
assert.sameValue(s.has(foo), false);
|
||||
assert.sameValue(result, true, 'WeakSet#delete returns true');
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.3
|
||||
description: >
|
||||
WeakSet.prototype.delete property descriptor
|
||||
info: >
|
||||
WeakSet.prototype.delete ( value )
|
||||
|
||||
17 ECMAScript Standard Built-in Objects
|
||||
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
assert.sameValue(
|
||||
typeof WeakSet.prototype.delete,
|
||||
'function',
|
||||
'typeof WeakSet.prototype.delete is "function"'
|
||||
);
|
||||
|
||||
verifyNotEnumerable(WeakSet.prototype, 'delete');
|
||||
verifyWritable(WeakSet.prototype, 'delete');
|
||||
verifyConfigurable(WeakSet.prototype, 'delete');
|
23
test/built-ins/WeakSet/prototype/delete/does-not-have-weaksetdata-internal-slot-array.js
vendored
Normal file
23
test/built-ins/WeakSet/prototype/delete/does-not-have-weaksetdata-internal-slot-array.js
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.3
|
||||
description: >
|
||||
Throws TypeError if context doesn't have a [[WeakSetData]] internal slot.
|
||||
info: >
|
||||
WeakSet.prototype.delete ( value )
|
||||
|
||||
...
|
||||
3. If S does not have a [[WeakSetData]] internal slot, throw a TypeError
|
||||
exception.
|
||||
...
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
WeakSet.prototype.delete.call([], {});
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
var s = new WeakSet();
|
||||
s.delete.call([], {});
|
||||
});
|
23
test/built-ins/WeakSet/prototype/delete/does-not-have-weaksetdata-internal-slot-map.js
vendored
Normal file
23
test/built-ins/WeakSet/prototype/delete/does-not-have-weaksetdata-internal-slot-map.js
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.3
|
||||
description: >
|
||||
Throws TypeError if context doesn't have a [[WeakSetData]] internal slot.
|
||||
info: >
|
||||
WeakSet.prototype.delete ( value )
|
||||
|
||||
...
|
||||
3. If S does not have a [[WeakSetData]] internal slot, throw a TypeError
|
||||
exception.
|
||||
...
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
WeakSet.prototype.delete.call(new Map(), {});
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
var s = new WeakSet();
|
||||
s.delete.call(new Map(), {});
|
||||
});
|
23
test/built-ins/WeakSet/prototype/delete/does-not-have-weaksetdata-internal-slot-object.js
vendored
Normal file
23
test/built-ins/WeakSet/prototype/delete/does-not-have-weaksetdata-internal-slot-object.js
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.3
|
||||
description: >
|
||||
Throws TypeError if context doesn't have a [[WeakSetData]] internal slot.
|
||||
info: >
|
||||
WeakSet.prototype.delete ( value )
|
||||
|
||||
...
|
||||
3. If S does not have a [[WeakSetData]] internal slot, throw a TypeError
|
||||
exception.
|
||||
...
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
WeakSet.prototype.delete.call({}, {});
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
var s = new WeakSet();
|
||||
s.delete.call({}, {});
|
||||
});
|
24
test/built-ins/WeakSet/prototype/delete/does-not-have-weaksetdata-internal-slot-set.js
vendored
Normal file
24
test/built-ins/WeakSet/prototype/delete/does-not-have-weaksetdata-internal-slot-set.js
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.3
|
||||
description: >
|
||||
Throws TypeError if context doesn't have a [[WeakSetData]] internal slot.
|
||||
info: >
|
||||
WeakSet.prototype.delete ( value )
|
||||
|
||||
...
|
||||
3. If S does not have a [[WeakSetData]] internal slot, throw a TypeError
|
||||
exception.
|
||||
...
|
||||
features: [Set]
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
WeakSet.prototype.delete.call(new Set(), {});
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
var s = new WeakSet();
|
||||
s.delete.call(new Set(), {});
|
||||
});
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.3
|
||||
description: >
|
||||
Throws TypeError if context doesn't have a [[WeakSetData]] internal slot.
|
||||
info: >
|
||||
WeakSet.prototype.delete ( value )
|
||||
|
||||
...
|
||||
3. If S does not have a [[WeakSetData]] internal slot, throw a TypeError
|
||||
exception.
|
||||
...
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
WeakSet.prototype.delete.call(WeakSet.prototype, {});
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
var s = new WeakSet();
|
||||
s.delete.call(WeakSet.prototype, {});
|
||||
});
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.3
|
||||
description: >
|
||||
WeakSet.prototype.delete.length value and writability.
|
||||
info: >
|
||||
WeakSet.prototype.delete ( value )
|
||||
|
||||
17 ECMAScript Standard Built-in Objects
|
||||
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
assert.sameValue(
|
||||
WeakSet.prototype.delete.length, 1,
|
||||
'The value of WeakSet.prototype.delete.length is 1'
|
||||
);
|
||||
|
||||
verifyNotEnumerable(WeakSet.prototype.delete, 'length');
|
||||
verifyNotWritable(WeakSet.prototype.delete, 'length');
|
||||
verifyConfigurable(WeakSet.prototype.delete, 'length');
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.3
|
||||
description: >
|
||||
WeakSet.prototype.delete.name value and writability.
|
||||
info: >
|
||||
WeakSet.prototype.delete ( value )
|
||||
|
||||
17 ECMAScript Standard Built-in Objects
|
||||
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
assert.sameValue(
|
||||
WeakSet.prototype.delete.name, 'delete',
|
||||
'The value of WeakSet.prototype.delete.name is "delete"'
|
||||
);
|
||||
|
||||
verifyNotEnumerable(WeakSet.prototype.delete, 'name');
|
||||
verifyNotWritable(WeakSet.prototype.delete, 'name');
|
||||
verifyConfigurable(WeakSet.prototype.delete, 'name');
|
21
test/built-ins/WeakSet/prototype/delete/returns-false-value-is-not-object.js
vendored
Normal file
21
test/built-ins/WeakSet/prototype/delete/returns-false-value-is-not-object.js
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.3
|
||||
description: >
|
||||
Return false if value is not a non-null Object.
|
||||
info: >
|
||||
WeakSet.prototype.delete ( value )
|
||||
|
||||
4. If Type(value) is not Object, return false.
|
||||
features: [Symbol]
|
||||
---*/
|
||||
|
||||
var s = new WeakSet();
|
||||
|
||||
assert.sameValue(s.delete(1), false);
|
||||
assert.sameValue(s.delete(''), false);
|
||||
assert.sameValue(s.delete(null), false);
|
||||
assert.sameValue(s.delete(undefined), false);
|
||||
assert.sameValue(s.delete(true), false);
|
||||
assert.sameValue(s.delete(Symbol()), false);
|
17
test/built-ins/WeakSet/prototype/delete/returns-false-when-delete-is-noop.js
vendored
Normal file
17
test/built-ins/WeakSet/prototype/delete/returns-false-when-delete-is-noop.js
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.3
|
||||
description: >
|
||||
Return false if entry wasn't in the WeakSet.
|
||||
info: >
|
||||
WeakSet.prototype.delete ( value )
|
||||
|
||||
...
|
||||
7. Return false.
|
||||
|
||||
---*/
|
||||
|
||||
var s = new WeakSet();
|
||||
|
||||
assert.sameValue(s.delete({}), false);
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.3
|
||||
description: Throws TypeError if `this` is not Object.
|
||||
info: >
|
||||
WeakSet.prototype.delete ( value )
|
||||
|
||||
1. Let S be the this value.
|
||||
2. If Type(S) is not Object, throw a TypeError exception.
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
WeakSet.prototype.delete.call(false, {});
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
var s = new WeakSet();
|
||||
s.delete.call(false, {});
|
||||
});
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.3
|
||||
description: Throws TypeError if `this` is not Object.
|
||||
info: >
|
||||
WeakSet.prototype.delete ( value )
|
||||
|
||||
1. Let S be the this value.
|
||||
2. If Type(S) is not Object, throw a TypeError exception.
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
WeakSet.prototype.delete.call(null, {});
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
var s = new WeakSet();
|
||||
s.delete.call(null, {});
|
||||
});
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.3
|
||||
description: Throws TypeError if `this` is not Object.
|
||||
info: >
|
||||
WeakSet.prototype.delete ( value )
|
||||
|
||||
1. Let S be the this value.
|
||||
2. If Type(S) is not Object, throw a TypeError exception.
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
WeakSet.prototype.delete.call(0, {});
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
var s = new WeakSet();
|
||||
s.delete.call(0, {});
|
||||
});
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.3
|
||||
description: Throws TypeError if `this` is not Object.
|
||||
info: >
|
||||
WeakSet.prototype.delete ( value )
|
||||
|
||||
1. Let S be the this value.
|
||||
2. If Type(S) is not Object, throw a TypeError exception.
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
WeakSet.prototype.delete.call('', {});
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
var s = new WeakSet();
|
||||
s.delete.call('', {});
|
||||
});
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.3
|
||||
description: Throws TypeError if `this` is not Object.
|
||||
info: >
|
||||
WeakSet.prototype.delete ( value )
|
||||
|
||||
1. Let S be the this value.
|
||||
2. If Type(S) is not Object, throw a TypeError exception.
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
WeakSet.prototype.delete.call(Symbol(), {});
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
var s = new WeakSet();
|
||||
s.delete.call(Symbol(), {});
|
||||
});
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.3
|
||||
description: Throws TypeError if `this` is not Object.
|
||||
info: >
|
||||
WeakSet.prototype.delete ( value )
|
||||
|
||||
1. Let S be the this value.
|
||||
2. If Type(S) is not Object, throw a TypeError exception.
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
WeakSet.prototype.delete.call(undefined, {});
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
var s = new WeakSet();
|
||||
s.delete.call(undefined, {});
|
||||
});
|
23
test/built-ins/WeakSet/prototype/has/does-not-have-weaksetdata-internal-slot-array.js
vendored
Normal file
23
test/built-ins/WeakSet/prototype/has/does-not-have-weaksetdata-internal-slot-array.js
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.4
|
||||
description: >
|
||||
Throws TypeError if context doesn't have a [[WeakSetData]] internal slot.
|
||||
info: >
|
||||
WeakSet.prototype.has ( value )
|
||||
|
||||
...
|
||||
3. If S does not have a [[WeakSetData]] internal slot, throw a TypeError
|
||||
exception.
|
||||
...
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
WeakSet.prototype.has.call([], {});
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
var s = new WeakSet();
|
||||
s.has.call([], {});
|
||||
});
|
23
test/built-ins/WeakSet/prototype/has/does-not-have-weaksetdata-internal-slot-map.js
vendored
Normal file
23
test/built-ins/WeakSet/prototype/has/does-not-have-weaksetdata-internal-slot-map.js
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.4
|
||||
description: >
|
||||
Throws TypeError if context doesn't have a [[WeakSetData]] internal slot.
|
||||
info: >
|
||||
WeakSet.prototype.has ( value )
|
||||
|
||||
...
|
||||
3. If S does not have a [[WeakSetData]] internal slot, throw a TypeError
|
||||
exception.
|
||||
...
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
WeakSet.prototype.has.call(new Map(), {});
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
var s = new WeakSet();
|
||||
s.has.call(new Map(), {});
|
||||
});
|
23
test/built-ins/WeakSet/prototype/has/does-not-have-weaksetdata-internal-slot-object.js
vendored
Normal file
23
test/built-ins/WeakSet/prototype/has/does-not-have-weaksetdata-internal-slot-object.js
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.4
|
||||
description: >
|
||||
Throws TypeError if context doesn't have a [[WeakSetData]] internal slot.
|
||||
info: >
|
||||
WeakSet.prototype.has ( value )
|
||||
|
||||
...
|
||||
3. If S does not have a [[WeakSetData]] internal slot, throw a TypeError
|
||||
exception.
|
||||
...
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
WeakSet.prototype.has.call({}, {});
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
var s = new WeakSet();
|
||||
s.has.call({}, {});
|
||||
});
|
24
test/built-ins/WeakSet/prototype/has/does-not-have-weaksetdata-internal-slot-set.js
vendored
Normal file
24
test/built-ins/WeakSet/prototype/has/does-not-have-weaksetdata-internal-slot-set.js
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.4
|
||||
description: >
|
||||
Throws TypeError if context doesn't have a [[WeakSetData]] internal slot.
|
||||
info: >
|
||||
WeakSet.prototype.has ( value )
|
||||
|
||||
...
|
||||
3. If S does not have a [[WeakSetData]] internal slot, throw a TypeError
|
||||
exception.
|
||||
...
|
||||
features: [Set]
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
WeakSet.prototype.has.call(new Set(), {});
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
var s = new WeakSet();
|
||||
s.has.call(new Set(), {});
|
||||
});
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.4
|
||||
description: >
|
||||
Throws TypeError if context doesn't have a [[WeakSetData]] internal slot.
|
||||
info: >
|
||||
WeakSet.prototype.has ( value )
|
||||
|
||||
...
|
||||
3. If S does not have a [[WeakSetData]] internal slot, throw a TypeError
|
||||
exception.
|
||||
...
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
WeakSet.prototype.has.call(WeakSet.prototype, {});
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
var s = new WeakSet();
|
||||
s.has.call(WeakSet.prototype, {});
|
||||
});
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.4
|
||||
description: >
|
||||
WeakSet.prototype.has property descriptor
|
||||
info: >
|
||||
WeakSet.prototype.has ( value )
|
||||
|
||||
17 ECMAScript Standard Built-in Objects
|
||||
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
assert.sameValue(
|
||||
typeof WeakSet.prototype.has,
|
||||
'function',
|
||||
'typeof WeakSet.prototype.has is "function"'
|
||||
);
|
||||
|
||||
verifyNotEnumerable(WeakSet.prototype, 'has');
|
||||
verifyWritable(WeakSet.prototype, 'has');
|
||||
verifyConfigurable(WeakSet.prototype, 'has');
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.4
|
||||
description: >
|
||||
WeakSet.prototype.has.length value and writability.
|
||||
info: >
|
||||
WeakSet.prototype.has ( value )
|
||||
|
||||
17 ECMAScript Standard Built-in Objects
|
||||
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
assert.sameValue(
|
||||
WeakSet.prototype.has.length, 1,
|
||||
'The value of WeakSet.prototype.has.length is 1'
|
||||
);
|
||||
|
||||
verifyNotEnumerable(WeakSet.prototype.has, 'length');
|
||||
verifyNotWritable(WeakSet.prototype.has, 'length');
|
||||
verifyConfigurable(WeakSet.prototype.has, 'length');
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.4
|
||||
description: >
|
||||
WeakSet.prototype.has.name value and writability.
|
||||
info: >
|
||||
WeakSet.prototype.has ( value )
|
||||
|
||||
17 ECMAScript Standard Built-in Objects
|
||||
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
assert.sameValue(
|
||||
WeakSet.prototype.has.name, 'has',
|
||||
'The value of WeakSet.prototype.has.name is "has"'
|
||||
);
|
||||
|
||||
verifyNotEnumerable(WeakSet.prototype.has, 'name');
|
||||
verifyNotWritable(WeakSet.prototype.has, 'name');
|
||||
verifyConfigurable(WeakSet.prototype.has, 'name');
|
21
test/built-ins/WeakSet/prototype/has/returns-false-when-value-is-not-object.js
vendored
Normal file
21
test/built-ins/WeakSet/prototype/has/returns-false-when-value-is-not-object.js
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.4
|
||||
description: >
|
||||
Returns false if value is not a non-null Object.
|
||||
info: >
|
||||
WeakSet.prototype.has ( value )
|
||||
|
||||
5. If Type(value) is not Object, return false.
|
||||
features: [Symbol]
|
||||
---*/
|
||||
|
||||
var s = new WeakSet();
|
||||
|
||||
assert.sameValue(s.has(1), false);
|
||||
assert.sameValue(s.has(''), false);
|
||||
assert.sameValue(s.has(null), false);
|
||||
assert.sameValue(s.has(undefined), false);
|
||||
assert.sameValue(s.has(true), false);
|
||||
assert.sameValue(s.has(Symbol()), false);
|
25
test/built-ins/WeakSet/prototype/has/returns-false-when-value-not-present.js
vendored
Normal file
25
test/built-ins/WeakSet/prototype/has/returns-false-when-value-not-present.js
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.4
|
||||
description: >
|
||||
Return false when value is not present in the WeakSet entries.
|
||||
info: >
|
||||
WeakSet.prototype.has ( value )
|
||||
|
||||
...
|
||||
7. Return false.
|
||||
|
||||
---*/
|
||||
|
||||
var foo = {};
|
||||
var bar = {};
|
||||
var s = new WeakSet();
|
||||
|
||||
assert.sameValue(s.has(foo), false);
|
||||
|
||||
s.add(foo);
|
||||
assert.sameValue(s.has(bar), false);
|
||||
|
||||
s.delete(foo);
|
||||
assert.sameValue(s.has(foo), false);
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.4
|
||||
description: >
|
||||
Returns true when value is present in the WeakSet entries list.
|
||||
info: >
|
||||
WeakSet.prototype.has ( value )
|
||||
|
||||
...
|
||||
6. Repeat for each e that is an element of entries,
|
||||
a. If e is not empty and SameValue(e, value) is true, return true.
|
||||
...
|
||||
---*/
|
||||
|
||||
var foo = {};
|
||||
var s = new WeakSet();
|
||||
|
||||
s.add(foo);
|
||||
assert.sameValue(s.has(foo), true);
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.4
|
||||
description: Throws TypeError if `this` is not Object.
|
||||
info: >
|
||||
WeakSet.prototype.has ( value )
|
||||
|
||||
1. Let S be the this value.
|
||||
2. If Type(S) is not Object, throw a TypeError exception.
|
||||
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
WeakSet.prototype.has.call(false, {});
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
var s = new WeakSet();
|
||||
s.has.call(false, {});
|
||||
});
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.4
|
||||
description: Throws TypeError if `this` is not Object.
|
||||
info: >
|
||||
WeakSet.prototype.has ( value )
|
||||
|
||||
1. Let S be the this value.
|
||||
2. If Type(S) is not Object, throw a TypeError exception.
|
||||
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
WeakSet.prototype.has.call(null, {});
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
var s = new WeakSet();
|
||||
s.has.call(null, {});
|
||||
});
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.4
|
||||
description: Throws TypeError if `this` is not Object.
|
||||
info: >
|
||||
WeakSet.prototype.has ( value )
|
||||
|
||||
1. Let S be the this value.
|
||||
2. If Type(S) is not Object, throw a TypeError exception.
|
||||
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
WeakSet.prototype.has.call(0, {});
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
var s = new WeakSet();
|
||||
s.has.call(0, {});
|
||||
});
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.4
|
||||
description: Throws TypeError if `this` is not Object.
|
||||
info: >
|
||||
WeakSet.prototype.has ( value )
|
||||
|
||||
1. Let S be the this value.
|
||||
2. If Type(S) is not Object, throw a TypeError exception.
|
||||
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
WeakSet.prototype.has.call('', {});
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
var s = new WeakSet();
|
||||
s.has.call('', {});
|
||||
});
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.4
|
||||
description: Throws TypeError if `this` is not Object.
|
||||
info: >
|
||||
WeakSet.prototype.has ( value )
|
||||
|
||||
1. Let S be the this value.
|
||||
2. If Type(S) is not Object, throw a TypeError exception.
|
||||
features: [Symbol]
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
WeakSet.prototype.has.call(Symbol(), {});
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
var s = new WeakSet();
|
||||
s.has.call(Symbol(), {});
|
||||
});
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.3.4
|
||||
description: Throws TypeError if `this` is not Object.
|
||||
info: >
|
||||
WeakSet.prototype.has ( value )
|
||||
|
||||
1. Let S be the this value.
|
||||
2. If Type(S) is not Object, throw a TypeError exception.
|
||||
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
WeakSet.prototype.has.call(undefined, {});
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
var s = new WeakSet();
|
||||
s.has.call(undefined, {});
|
||||
});
|
|
@ -0,0 +1,12 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.2.1
|
||||
description: >
|
||||
WeakSet.prototype is not writable, not enumerable and not configurable.
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
verifyNotEnumerable(WeakSet, 'prototype');
|
||||
verifyNotWritable(WeakSet, 'prototype');
|
||||
verifyNotConfigurable(WeakSet, 'prototype');
|
|
@ -3,7 +3,7 @@
|
|||
/*---
|
||||
es6id: 23.4.3.1_S2
|
||||
description: >
|
||||
Symbol may not be used as a WeakSet entry
|
||||
Symbol may not be used as a WeakSet entry
|
||||
features: [WeakSet]
|
||||
---*/
|
||||
var weakset = new WeakSet();
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.1.1
|
||||
description: >
|
||||
The WeakSet constructor is the %WeakSet% intrinsic object and the initial
|
||||
value of the WeakSet property of the global object.
|
||||
info: >
|
||||
23.4.1.1 WeakSet ( [ iterable ] )
|
||||
|
||||
1. If NewTarget is undefined, throw a TypeError exception.
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
WeakSet();
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
WeakSet([]);
|
||||
});
|
|
@ -0,0 +1,14 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.4.1.1
|
||||
description: >
|
||||
WeakSet ( [ iterable ] )
|
||||
|
||||
17 ECMAScript Standard Built-in Objects
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
verifyNotEnumerable(this, 'WeakSet');
|
||||
verifyWritable(this, 'WeakSet');
|
||||
verifyConfigurable(this, 'WeakSet');
|
Loading…
Reference in New Issue