S15.10.2.8_A3_T16.js (1740B)
1 // Copyright 2009 the Sputnik authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 info: | 6 Parentheses of the form ( Disjunction ) serve both to group the components of the Disjunction pattern together and to save the result of the match. 7 The result can be used either in a backreference (\ followed by a nonzero decimal number), 8 referenced in a replace string, 9 or returned as part of an array from the regular expression matching function 10 es5id: 15.10.2.8_A3_T16 11 description: "see bug http:bugzilla.mozilla.org/show_bug.cgi?id=119909" 12 ---*/ 13 14 var __strOriginal = "hello"; 15 var __openParen = '(?:'; 16 var __closeParen = ')'; 17 var __pattern = ''; 18 var numParens = 200; 19 20 for (var i=0; i<numParens; i++) 21 __pattern += __openParen; 22 23 __pattern += __strOriginal; 24 25 for (i=0; i<numParens; i++) 26 __pattern += __closeParen; 27 28 var __re = new RegExp(__pattern); 29 30 var __executed = __re.exec(__strOriginal); 31 32 var __expected = [__strOriginal]; 33 __expected.index = 0; 34 __expected.input = __strOriginal; 35 36 assert.sameValue( 37 __executed.length, 38 __expected.length, 39 'The value of __executed.length is expected to equal the value of __expected.length' 40 ); 41 42 assert.sameValue( 43 __executed.index, 44 __expected.index, 45 'The value of __executed.index is expected to equal the value of __expected.index' 46 ); 47 48 assert.sameValue( 49 __executed.input, 50 __expected.input, 51 'The value of __executed.input is expected to equal the value of __expected.input' 52 ); 53 54 for(var index=0; index<__expected.length; index++) { 55 assert.sameValue( 56 __executed[index], 57 __expected[index], 58 'The value of __executed[index] is expected to equal the value of __expected[index]' 59 ); 60 } 61 62 reportCompare(0, 0);