Debian Codegraph @

rhino/testsrc/tests/js1_2/regexp/octal.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.js';
7
8 /**
9 Filename: octal.js
10 Description: 'Tests regular expressions containing \<number> '
11
12 Author: Nick Lerissa
13 Date: March 10, 1998
14 */
15
16 var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
17 var VERSION = 'no version';
18 startTest();
19 var TITLE = 'RegExp: \# (octal) ';
20
21 writeHeaderToLog('Executing script: octal.js');
22 writeHeaderToLog( SECTION + " "+ TITLE);
23
24 var testPattern = '\\101\\102\\103\\104\\105\\106\\107\\110\\111\\112\\113\\114\\115\\116\\117\\120\\121\\122\\123\\124\\125\\126\\127\\130\\131\\132';
25
26 var testString = "12345ABCDEFGHIJKLMNOPQRSTUVWXYZ67890";
27
28 new TestCase ( SECTION,
29 "'" + testString + "'.match(new RegExp('" + testPattern + "'))",
30 String(["ABCDEFGHIJKLMNOPQRSTUVWXYZ"]), String(testString.match(new RegExp(testPattern))));
31
32 testPattern = '\\141\\142\\143\\144\\145\\146\\147\\150\\151\\152\\153\\154\\155\\156\\157\\160\\161\\162\\163\\164\\165\\166\\167\\170\\171\\172';
33
34 testString = "12345AabcdefghijklmnopqrstuvwxyzZ67890";
35
36 new TestCase ( SECTION,
37 "'" + testString + "'.match(new RegExp('" + testPattern + "'))",
38 String(["abcdefghijklmnopqrstuvwxyz"]), String(testString.match(new RegExp(testPattern))));
39
40 testPattern = '\\40\\41\\42\\43\\44\\45\\46\\47\\50\\51\\52\\53\\54\\55\\56\\57\\60\\61\\62\\63';
41
42 testString = "abc !\"#$%&'()*+,-./0123ZBC";
43
44 new TestCase ( SECTION,
45 "'" + testString + "'.match(new RegExp('" + testPattern + "'))",
46 String([" !\"#$%&'()*+,-./0123"]), String(testString.match(new RegExp(testPattern))));
47
48 testPattern = '\\64\\65\\66\\67\\70\\71\\72\\73\\74\\75\\76\\77\\100';
49
50 testString = "123456789:;<=>?@ABC";
51
52 new TestCase ( SECTION,
53 "'" + testString + "'.match(new RegExp('" + testPattern + "'))",
54 String(["456789:;<=>?@"]), String(testString.match(new RegExp(testPattern))));
55
56 testPattern = '\\173\\174\\175\\176';
57
58 testString = "1234{|}~ABC";
59
60 new TestCase ( SECTION,
61 "'" + testString + "'.match(new RegExp('" + testPattern + "'))",
62 String(["{|}~"]), String(testString.match(new RegExp(testPattern))));
63
64 new TestCase ( SECTION,
65 "'canthisbeFOUND'.match(new RegExp('[A-\\132]+'))",
66 String(["FOUND"]), String('canthisbeFOUND'.match(new RegExp('[A-\\132]+'))));
67
68 new TestCase ( SECTION,
69 "'canthisbeFOUND'.match(new RegExp('[\\141-\\172]+'))",
70 String(["canthisbe"]), String('canthisbeFOUND'.match(new RegExp('[\\141-\\172]+'))));
71
72 new TestCase ( SECTION,
73 "'canthisbeFOUND'.match(/[\\141-\\172]+/)",
74 String(["canthisbe"]), String('canthisbeFOUND'.match(/[\141-\172]+/)));
75
76 test();