Debian Codegraph @

rhino/testsrc/tests/ecma_2/RegExp/octal-001.js

raw symbols SCIP
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 gTestfile = 'octal-001.js';
7
8 /**
9 * File Name: RegExp/octal-001.js
10 * ECMA Section: 15.7.1
11 * Description: Based on ECMA 2 Draft 7 February 1999
12 * Simple test cases for matching OctalEscapeSequences.
13 * Author: [email protected]
14 * Date: 19 February 1999
15 */
16 var SECTION = "RegExp/octal-001.js";
17 var VERSION = "ECMA_2";
18 var TITLE = "RegExp patterns that contain OctalEscapeSequences";
19 var BUGNUMBER="http://scopus/bugsplat/show_bug.cgi?id=346196";
20
21 startTest();
22
23
24 // backreference
25 AddRegExpCases(
26 /(.)\1/,
27 "/(.)\\1/",
28 "HI!!",
29 "HI!",
30 2,
31 ["!!", "!"] );
32
33 test();
34
35 function AddRegExpCases(
36 regexp, str_regexp, pattern, str_pattern, index, matches_array ) {
37
38 // prevent a runtime error
39
40 if ( regexp.exec(pattern) == null || matches_array == null ) {
41 AddTestCase(
42 regexp + ".exec(" + str_pattern +")",
43 matches_array,
44 regexp.exec(pattern) );
45
46 return;
47 }
48 AddTestCase(
49 str_regexp + ".exec(" + str_pattern +").length",
50 matches_array.length,
51 regexp.exec(pattern).length );
52
53 AddTestCase(
54 str_regexp + ".exec(" + str_pattern +").index",
55 index,
56 regexp.exec(pattern).index );
57
58 AddTestCase(
59 str_regexp + ".exec(" + str_pattern +").input",
60 pattern,
61 regexp.exec(pattern).input );
62
63 AddTestCase(
64 str_regexp + ".exec(" + str_pattern +").toString()",
65 matches_array.toString(),
66 regexp.exec(pattern).toString() );
67 /*
68 var limit = matches_array.length > regexp.exec(pattern).length
69 ? matches_array.length
70 : regexp.exec(pattern).length;
71
72 for ( var matches = 0; matches < limit; matches++ ) {
73 AddTestCase(
74 str_regexp + ".exec(" + str_pattern +")[" + matches +"]",
75 matches_array[matches],
76 regexp.exec(pattern)[matches] );
77 }
78 */
79 }