Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/RegExp/S15.10.2.9_A1_T2.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 An escape sequence of the form \ followed by a nonzero decimal number n
7 matches the result of the nth set of capturing parentheses (see
8 15.10.2.11)
9 es5id: 15.10.2.9_A1_T2
10 description: >
11 Execute
12 /([xu]\d{2}([A-H]{2})?)\1/.exec("x09x12x01x01u00FFu00FFx04x04x23")
13 and check results
14 ---*/
15
16 var __executed = /([xu]\d{2}([A-H]{2})?)\1/.exec("x09x12x01x01u00FFu00FFx04x04x23");
17
18 var __expected = ["x01x01", "x01", undefined];
19 __expected.index = 6;
20 __expected.input = "x09x12x01x01u00FFu00FFx04x04x23";
21
22 //CHECK#1
23 if (__executed.length !== __expected.length) {
24 $ERROR('#1: __executed = /([xu]\\d{2}([A-H]{2})?)\\1/.exec("x09x12x01x01u00FFu00FFx04x04x23"); __executed.length === ' + __expected.length + '. Actual: ' + __executed.length);
25 }
26
27 //CHECK#2
28 if (__executed.index !== __expected.index) {
29 $ERROR('#2: __executed = /([xu]\\d{2}([A-H]{2})?)\\1/.exec("x09x12x01x01u00FFu00FFx04x04x23"); __executed.index === ' + __expected.index + '. Actual: ' + __executed.index);
30 }
31
32 //CHECK#3
33 if (__executed.input !== __expected.input) {
34 $ERROR('#3: __executed = /([xu]\\d{2}([A-H]{2})?)\\1/.exec("x09x12x01x01u00FFu00FFx04x04x23"); __executed.input === ' + __expected.input + '. Actual: ' + __executed.input);
35 }
36
37 //CHECK#4
38 for(var index=0; index<__expected.length; index++) {
39 if (__executed[index] !== __expected[index]) {
40 $ERROR('#4: __executed = /([xu]\\d{2}([A-H]{2})?)\\1/.exec("x09x12x01x01u00FFu00FFx04x04x23"); __executed[' + index + '] === ' + __expected[index] + '. Actual: ' + __executed[index]);
41 }
42 }