Debian Codegraph @

rhino/testsrc/tests/js1_2/regexp/endLine.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 = 'endLine.js';
7
8 /**
9 Filename: endLine.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: endLine.js');
22 writeHeaderToLog( SECTION + " "+ TITLE);
23
24
25 // 'abcde'.match(new RegExp('de$'))
26 new TestCase ( SECTION, "'abcde'.match(new RegExp('de$'))",
27 String(["de"]), String('abcde'.match(new RegExp('de$'))));
28
29 // 'ab\ncde'.match(new RegExp('..$e$'))
30 new TestCase ( SECTION, "'ab\ncde'.match(new RegExp('..$e$'))",
31 null, 'ab\ncde'.match(new RegExp('..$e$')));
32
33 // 'yyyyy'.match(new RegExp('xxx$'))
34 new TestCase ( SECTION, "'yyyyy'.match(new RegExp('xxx$'))",
35 null, 'yyyyy'.match(new RegExp('xxx$')));
36
37 // 'a$$$'.match(new RegExp('\\$+$'))
38 new TestCase ( SECTION, "'a$$$'.match(new RegExp('\\$+$'))",
39 String(['$$$']), String('a$$$'.match(new RegExp('\\$+$'))));
40
41 // 'a$$$'.match(/\$+$/)
42 new TestCase ( SECTION, "'a$$$'.match(/\\$+$/)",
43 String(['$$$']), String('a$$$'.match(/\$+$/)));
44
45 RegExp.multiline = true;
46 // 'abc\n123xyz890\nxyz'.match(new RegExp('\d+$')) <multiline==true>
47 new TestCase ( SECTION, "'abc\n123xyz890\nxyz'.match(new RegExp('\\d+$'))",
48 String(['890']), String('abc\n123xyz890\nxyz'.match(new RegExp('\\d+$'))));
49
50 test();