summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/RegExp/prototype/Symbol.search/set-lastindex-init.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/RegExp/prototype/Symbol.search/set-lastindex-init.js')
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/Symbol.search/set-lastindex-init.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/Symbol.search/set-lastindex-init.js b/js/src/tests/test262/built-ins/RegExp/prototype/Symbol.search/set-lastindex-init.js
new file mode 100644
index 0000000000..17360b72f6
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/Symbol.search/set-lastindex-init.js
@@ -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: 21.2.5.9
+description: >
+ The `lastIndex` value is set to 0 immediately prior to match execution
+info: |
+ [...]
+ 7. Let status be Set(rx, "lastIndex", 0, true).
+ 8. ReturnIfAbrupt(status).
+ 9. Let result be RegExpExec(rx, S).
+ [...]
+features: [Symbol.search]
+---*/
+
+var duringExec;
+var fakeRe = {
+ lastIndex: 34,
+ exec: function() {
+ duringExec = fakeRe.lastIndex;
+ return null;
+ }
+};
+
+RegExp.prototype[Symbol.search].call(fakeRe);
+
+assert.sameValue(duringExec, 0);
+
+reportCompare(0, 0);