summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Set/prototype/add/preserves-insertion-order.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/Set/prototype/add/preserves-insertion-order.js')
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/add/preserves-insertion-order.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Set/prototype/add/preserves-insertion-order.js b/js/src/tests/test262/built-ins/Set/prototype/add/preserves-insertion-order.js
new file mode 100644
index 0000000000..1cef6a0cc7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/add/preserves-insertion-order.js
@@ -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.
+/*---
+esid: sec-set.prototype.add
+description: >
+ Set.prototype.add ( value )
+
+ ...
+ 7. Append value as the last element of entries.
+ ...
+---*/
+
+var s = new Set();
+var expects = [1, 2, 3];
+
+s.add(1).add(2).add(3);
+
+s.forEach(function(value) {
+ assert.sameValue(value, expects.shift());
+});
+
+assert.sameValue(expects.length, 0, "The value of `expects.length` is `0`");
+
+reportCompare(0, 0);