Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/RegExp/S15.10.2.7_A5_T8.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 The production QuantifierPrefix :: ? evaluates by returning the two
7 results 0 and 1
8 es5id: 15.10.2.7_A5_T8
9 description: Execute /x?ay?bz?c/.exec("abcd") and check results
10 ---*/
11
12 var __executed = /x?ay?bz?c/.exec("abcd");
13
14 var __expected = ["abc"];
15 __expected.index = 0;
16 __expected.input = "abcd";
17
18 //CHECK#1
19 if (__executed.length !== __expected.length) {
20 $ERROR('#1: __executed = /x?ay?bz?c/.exec("abcd"); __executed.length === ' + __expected.length + '. Actual: ' + __executed.length);
21 }
22
23 //CHECK#2
24 if (__executed.index !== __expected.index) {
25 $ERROR('#2: __executed = /x?ay?bz?c/.exec("abcd"); __executed.index === ' + __expected.index + '. Actual: ' + __executed.index);
26 }
27
28 //CHECK#3
29 if (__executed.input !== __expected.input) {
30 $ERROR('#3: __executed = /x?ay?bz?c/.exec("abcd"); __executed.input === ' + __expected.input + '. Actual: ' + __executed.input);
31 }
32
33 //CHECK#4
34 for(var index=0; index<__expected.length; index++) {
35 if (__executed[index] !== __expected[index]) {
36 $ERROR('#4: __executed = /x?ay?bz?c/.exec("abcd"); __executed[' + index + '] === ' + __expected[index] + '. Actual: ' + __executed[index]);
37 }
38 }