Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/RegExp/S15.10.2.8_A3_T17.js

raw
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_T17
11 description: "see bug http:bugzilla.mozilla.org/show_bug.cgi?id=169497"
12 ---*/
13
14 var __body="";
15 __body += '<body onXXX="alert(event.type);">\n';
16 __body += '<p>Kibology for all<\/p>\n';
17 __body += '<p>All for Kibology<\/p>\n';
18 __body += '<\/body>';
19
20 var __html="";
21 __html += '<html>\n';
22 __html += __body;
23 __html += '\n<\/html>';
24
25 var __executed = /<body.*>((.*\n?)*?)<\/body>/i.exec(__html);
26
27 var __expected = [__body, '\n<p>Kibology for all</p>\n<p>All for Kibology</p>\n', '<p>All for Kibology</p>\n'];
28 __expected.index = 7;
29 __expected.input = __html;
30
31 //CHECK#1
32 if (__executed.length !== __expected.length) {
33 $ERROR('#1: __executed = /<body.*>((.*\\n?)*?)<\\/body>/i.exec(__html); __executed.length === ' + __expected.length + '. Actual: ' + __executed.length);
34 }
35
36 //CHECK#2
37 if (__executed.index !== __expected.index) {
38 $ERROR('#2: __executed = /<body.*>((.*\\n?)*?)<\\/body>/i.exec(__html); __executed.index === ' + __expected.index + '. Actual: ' + __executed.index);
39 }
40
41 //CHECK#3
42 if (__executed.input !== __expected.input) {
43 $ERROR('#3: __executed = /<body.*>((.*\\n?)*?)<\\/body>/i.exec(__html); __executed.input === ' + __expected.input + '. Actual: ' + __executed.input);
44 }
45
46 //CHECK#4
47 for(var index=0; index<__expected.length; index++) {
48 if (__executed[index] !== __expected[index]) {
49 $ERROR('#4: __executed = /<body.*>((.*\\n?)*?)<\\/body>/i.exec(__html); __executed[' + index + '] === ' + __expected[index] + '. Actual: ' + __executed[index]);
50 }
51 }