1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit-test/tests/basic/string-regexp-capture-groups.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,21 @@ 1.4 +"abcdefg".match(/(x)y(z)/g); 1.5 +assertEq(RegExp.$1, ""); 1.6 + 1.7 +assertEq("abcdef".match(/a(b)cd/g)[0], "abcd"); 1.8 +assertEq(RegExp.$1, "b"); 1.9 +assertEq(RegExp.$2, ""); 1.10 + 1.11 +"abcdef".match(/(a)b(c)/g); 1.12 +assertEq(RegExp.$1, "a"); 1.13 +assertEq(RegExp.$2, "c"); 1.14 +assertEq(RegExp.$3, ""); 1.15 + 1.16 +"abcabdabe".match(/(a)b(.)/g); 1.17 +assertEq(RegExp.$1, "a"); 1.18 +assertEq(RegExp.$2, "e"); 1.19 + 1.20 +"abcdefg".match(/(x)y(z)/g); 1.21 +assertEq(RegExp.$1, "a"); //If there's no match, we don't update the statics. 1.22 + 1.23 +"abcdefg".match(/(g)/g); 1.24 +assertEq(RegExp.$1, "g");