diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/RegExp/prototype/Symbol.replace/g-init-lastindex.js')
-rw-r--r-- | js/src/tests/test262/built-ins/RegExp/prototype/Symbol.replace/g-init-lastindex.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/Symbol.replace/g-init-lastindex.js b/js/src/tests/test262/built-ins/RegExp/prototype/Symbol.replace/g-init-lastindex.js new file mode 100644 index 0000000000..ea824178e8 --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/prototype/Symbol.replace/g-init-lastindex.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. + +/*--- +description: Initialization of `lastIndex` property for "global" instances +es6id: 21.2.5.8 +info: | + 21.2.5.8 RegExp.prototype [ @@replace ] ( string, replaceValue ) + + [...] + 10. If global is true, then + [...] + c. Let setStatus be Set(rx, "lastIndex", 0, true). + [...] +features: [Symbol.replace] +---*/ + +var r = /./g; + +r.lastIndex = 1; + +assert.sameValue(r[Symbol.replace]('aa', 'x'), 'xx'); + +reportCompare(0, 0); |