blob: 3c9b3085769f002123ec0deedfe5bd7922026ccb [file] [log] [blame]
keith_miller@apple.combcc77f22016-07-15 06:03:25 +00001// Copyright 2009 the Sputnik authors. All rights reserved.
2// This code is governed by the BSD license found in the LICENSE file.
3
4/*---
5info: >
6 The production QuantifierPrefix :: ? evaluates by returning the two
7 results 0 and 1
8es5id: 15.10.2.7_A5_T1
9description: >
10 Execute /java(script)?/.exec("state: javascript is extension of
11 ecma script") and check results
12---*/
13
14var __executed = /java(script)?/.exec("state: javascript is extension of ecma script");
15
16var __expected = ["javascript", "script"];
17__expected.index = 7;
18__expected.input = "state: javascript is extension of ecma script";
19
20//CHECK#1
21if (__executed.length !== __expected.length) {
22 $ERROR('#1: __executed = /java(script)?/.exec("state: javascript is extension of ecma script"); __executed.length === ' + __expected.length + '. Actual: ' + __executed.length);
23}
24
25//CHECK#2
26if (__executed.index !== __expected.index) {
27 $ERROR('#2: __executed = /java(script)?/.exec("state: javascript is extension of ecma script"); __executed.index === ' + __expected.index + '. Actual: ' + __executed.index);
28}
29
30//CHECK#3
31if (__executed.input !== __expected.input) {
32 $ERROR('#3: __executed = /java(script)?/.exec("state: javascript is extension of ecma script"); __executed.input === ' + __expected.input + '. Actual: ' + __executed.input);
33}
34
35//CHECK#4
36for(var index=0; index<__expected.length; index++) {
37 if (__executed[index] !== __expected[index]) {
38 $ERROR('#4: __executed = /java(script)?/.exec("state: javascript is extension of ecma script"); __executed[' + index + '] === ' + __expected[index] + '. Actual: ' + __executed[index]);
39 }
40}