Debian Codegraph @

rhino/testsrc/tests/js1_2/regexp/dot.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 = 'dot.js';
7
8 /**
9 Filename: dot.js
10 Description: 'Tests regular expressions containing .'
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: .';
20
21 writeHeaderToLog('Executing script: dot.js');
22 writeHeaderToLog( SECTION + " "+ TITLE);
23
24
25 // 'abcde'.match(new RegExp('ab.de'))
26 new TestCase ( SECTION, "'abcde'.match(new RegExp('ab.de'))",
27 String(["abcde"]), String('abcde'.match(new RegExp('ab.de'))));
28
29 // 'line 1\nline 2'.match(new RegExp('.+'))
30 new TestCase ( SECTION, "'line 1\nline 2'.match(new RegExp('.+'))",
31 String(["line 1"]), String('line 1\nline 2'.match(new RegExp('.+'))));
32
33 // 'this is a test'.match(new RegExp('.*a.*'))
34 new TestCase ( SECTION, "'this is a test'.match(new RegExp('.*a.*'))",
35 String(["this is a test"]), String('this is a test'.match(new RegExp('.*a.*'))));
36
37 // 'this is a *&^%$# test'.match(new RegExp('.+'))
38 new TestCase ( SECTION, "'this is a *&^%$# test'.match(new RegExp('.+'))",
39 String(["this is a *&^%$# test"]), String('this is a *&^%$# test'.match(new RegExp('.+'))));
40
41 // '....'.match(new RegExp('.+'))
42 new TestCase ( SECTION, "'....'.match(new RegExp('.+'))",
43 String(["...."]), String('....'.match(new RegExp('.+'))));
44
45 // 'abcdefghijklmnopqrstuvwxyz'.match(new RegExp('.+'))
46 new TestCase ( SECTION, "'abcdefghijklmnopqrstuvwxyz'.match(new RegExp('.+'))",
47 String(["abcdefghijklmnopqrstuvwxyz"]), String('abcdefghijklmnopqrstuvwxyz'.match(new RegExp('.+'))));
48
49 // 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.match(new RegExp('.+'))
50 new TestCase ( SECTION, "'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.match(new RegExp('.+'))",
51 String(["ABCDEFGHIJKLMNOPQRSTUVWXYZ"]), String('ABCDEFGHIJKLMNOPQRSTUVWXYZ'.match(new RegExp('.+'))));
52
53 // '`1234567890-=~!@#$%^&*()_+'.match(new RegExp('.+'))
54 new TestCase ( SECTION, "'`1234567890-=~!@#$%^&*()_+'.match(new RegExp('.+'))",
55 String(["`1234567890-=~!@#$%^&*()_+"]), String('`1234567890-=~!@#$%^&*()_+'.match(new RegExp('.+'))));
56
57 // '|\\[{]};:"\',<>.?/'.match(new RegExp('.+'))
58 new TestCase ( SECTION, "'|\\[{]};:\"\',<>.?/'.match(new RegExp('.+'))",
59 String(["|\\[{]};:\"\',<>.?/"]), String('|\\[{]};:\"\',<>.?/'.match(new RegExp('.+'))));
60
61 // '|\\[{]};:"\',<>.?/'.match(/.+/)
62 new TestCase ( SECTION, "'|\\[{]};:\"\',<>.?/'.match(/.+/)",
63 String(["|\\[{]};:\"\',<>.?/"]), String('|\\[{]};:\"\',<>.?/'.match(/.+/)));
64
65 test();