diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/RegExp/prototype/Symbol.match/g-match-empty-advance-lastindex.js')
-rw-r--r-- | js/src/tests/test262/built-ins/RegExp/prototype/Symbol.match/g-match-empty-advance-lastindex.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/Symbol.match/g-match-empty-advance-lastindex.js b/js/src/tests/test262/built-ins/RegExp/prototype/Symbol.match/g-match-empty-advance-lastindex.js new file mode 100644 index 0000000000..40787a069e --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/prototype/Symbol.match/g-match-empty-advance-lastindex.js @@ -0,0 +1,38 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + lastIndex is explicitly advanced for zero-length matches for "global" + instances +es6id: 21.2.5.6 +info: | + 7. If global is false, then + [...] + 8. Else global is true, + [...] + g. Repeat, + i. Let result be RegExpExec(rx, S). + [...] + iv. Else result is not null, + [...] + 5. If matchStr is the empty String, then + [...] + c. Let nextIndex be AdvanceStringIndex(S, thisIndex, + fullUnicode). + d. Let setStatus be Set(rx, "lastIndex", nextIndex, true). + e. ReturnIfAbrupt(setStatus). + 6. Increment n. +features: [Symbol.match] +---*/ + +var result = /(?:)/g[Symbol.match]('abc'); + +assert.notSameValue(result, null); +assert.sameValue(result.length, 4); +assert.sameValue(result[0], ''); +assert.sameValue(result[1], ''); +assert.sameValue(result[2], ''); +assert.sameValue(result[3], ''); + +reportCompare(0, 0); |