summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Set/prototype/size
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/Set/prototype/size')
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/size/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/size/length.js22
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/size/name.js25
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/size/returns-count-of-present-values-before-after-add-delete.js27
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/size/returns-count-of-present-values-by-insertion.js27
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/size/returns-count-of-present-values-by-iterable.js19
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/size/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/size/size.js29
8 files changed, 149 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Set/prototype/size/browser.js b/js/src/tests/test262/built-ins/Set/prototype/size/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/size/browser.js
diff --git a/js/src/tests/test262/built-ins/Set/prototype/size/length.js b/js/src/tests/test262/built-ins/Set/prototype/size/length.js
new file mode 100644
index 0000000000..4b0b0675dd
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/size/length.js
@@ -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.
+/*---
+esid: sec-get-set.prototype.size
+description: >
+ get Set.prototype.size
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+var descriptor = Object.getOwnPropertyDescriptor(Set.prototype, "size");
+
+
+assert.sameValue(descriptor.get.length, 0, "The value of `Set.prototype.size.length` is `0`");
+
+verifyNotEnumerable(descriptor.get, "length");
+verifyNotWritable(descriptor.get, "length");
+verifyConfigurable(descriptor.get, "length");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/size/name.js b/js/src/tests/test262/built-ins/Set/prototype/size/name.js
new file mode 100644
index 0000000000..79723d8f0e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/size/name.js
@@ -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.
+/*---
+esid: sec-get-set.prototype.size
+description: >
+ get Set.prototype.size
+
+ 17 ECMAScript Standard Built-in Objects
+
+ Functions that are specified as get or set accessor functions of built-in
+ properties have "get " or "set " prepended to the property name string.
+
+includes: [propertyHelper.js]
+---*/
+
+var descriptor = Object.getOwnPropertyDescriptor(Set.prototype, "size");
+
+
+assert.sameValue(descriptor.get.name, "get size", "The value of `descriptor.get.name` is `'get size'`");
+
+verifyNotEnumerable(descriptor.get, "name");
+verifyNotWritable(descriptor.get, "name");
+verifyConfigurable(descriptor.get, "name");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/size/returns-count-of-present-values-before-after-add-delete.js b/js/src/tests/test262/built-ins/Set/prototype/size/returns-count-of-present-values-before-after-add-delete.js
new file mode 100644
index 0000000000..6a6c083bae
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/size/returns-count-of-present-values-before-after-add-delete.js
@@ -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.
+/*---
+esid: sec-get-set.prototype.size
+description: >
+ get Set.prototype.size
+
+ 5. Let count be 0.
+ 6. For each e that is an element of entries
+ a. If e is not empty, set count to count+1.
+
+ Before and after add(), delete()
+---*/
+
+var s = new Set();
+
+assert.sameValue(s.size, 0, "The value of `s.size` is `0`");
+
+s.add(0);
+
+assert.sameValue(s.size, 1, "The value of `s.size` is `1`, after executing `s.add(0)`");
+
+s.delete(0);
+
+assert.sameValue(s.size, 0, "The value of `s.size` is `0`, after executing `s.delete(0)`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/size/returns-count-of-present-values-by-insertion.js b/js/src/tests/test262/built-ins/Set/prototype/size/returns-count-of-present-values-by-insertion.js
new file mode 100644
index 0000000000..b1ea12fc5f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/size/returns-count-of-present-values-by-insertion.js
@@ -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.
+/*---
+esid: sec-get-set.prototype.size
+description: >
+ get Set.prototype.size
+
+ 5. Let count be 0.
+ 6. For each e that is an element of entries
+ a. If e is not empty, set count to count+1.
+
+features: [Symbol]
+---*/
+
+var s = new Set();
+
+s.add(0);
+s.add(undefined);
+s.add(false);
+s.add(NaN);
+s.add(null);
+s.add("");
+s.add(Symbol());
+
+assert.sameValue(s.size, 7, "The value of `s.size` is `7`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/size/returns-count-of-present-values-by-iterable.js b/js/src/tests/test262/built-ins/Set/prototype/size/returns-count-of-present-values-by-iterable.js
new file mode 100644
index 0000000000..9ef5423a70
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/size/returns-count-of-present-values-by-iterable.js
@@ -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.
+/*---
+esid: sec-get-set.prototype.size
+description: >
+ get Set.prototype.size
+
+ 5. Let count be 0.
+ 6. For each e that is an element of entries
+ a. If e is not empty, set count to count+1.
+
+features: [Symbol]
+---*/
+
+var s = new Set([0, undefined, false, NaN, null, "", Symbol()]);
+
+assert.sameValue(s.size, 7, "The value of `s.size` is `7`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/size/shell.js b/js/src/tests/test262/built-ins/Set/prototype/size/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/size/shell.js
diff --git a/js/src/tests/test262/built-ins/Set/prototype/size/size.js b/js/src/tests/test262/built-ins/Set/prototype/size/size.js
new file mode 100644
index 0000000000..18b0566e2c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/size/size.js
@@ -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.
+/*---
+esid: sec-get-set.prototype.size
+description: >
+ get Set.prototype.size
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+var descriptor = Object.getOwnPropertyDescriptor(Set.prototype, "size");
+
+assert.sameValue(
+ typeof descriptor.get,
+ "function",
+ "`typeof descriptor.get` is `'function'`"
+);
+assert.sameValue(
+ typeof descriptor.set,
+ "undefined",
+ "`typeof descriptor.set` is `\"undefined\"`"
+);
+
+verifyNotEnumerable(Set.prototype, "size");
+verifyConfigurable(Set.prototype, "size");
+
+reportCompare(0, 0);