summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/RegExp/test-emptyMatch.js
blob: 6103c28d52198a9247d725ffb5671f32edfb2359 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
var BUGNUMBER = 1322035;
var summary = 'RegExp.prototype.test should update lastIndex to correct position even if pattern starts with .*';

print(BUGNUMBER + ": " + summary);

var regExp = /.*x?/g;
regExp.test('12345');
assertEq(regExp.lastIndex, 5);

regExp = /.*x*/g;
regExp.test('12345');
assertEq(regExp.lastIndex, 5);

regExp = /.*()/g;
regExp.test('12345');
assertEq(regExp.lastIndex, 5);

regExp = /.*(x|)/g;
regExp.test('12345');
assertEq(regExp.lastIndex, 5);

if (typeof reportCompare === "function")
  reportCompare(true, true);