Debian Codegraph @

rhino/testsrc/tests/js1_2/regexp/beginLine.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 = 'beginLine.js';
7
8 /**
9 Filename: beginLine.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: beginLine.js');
22 writeHeaderToLog( SECTION + " "+ TITLE);
23
24
25 // 'abcde'.match(new RegExp('^ab'))
26 new TestCase ( SECTION, "'abcde'.match(new RegExp('^ab'))",
27 String(["ab"]), String('abcde'.match(new RegExp('^ab'))));
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 // '^^^x'.match(new RegExp('^\\^+'))
38 new TestCase ( SECTION, "'^^^x'.match(new RegExp('^\\^+'))",
39 String(['^^^']), String('^^^x'.match(new RegExp('^\\^+'))));
40
41 // '^^^x'.match(/^\^+/)
42 new TestCase ( SECTION, "'^^^x'.match(/^\\^+/)",
43 String(['^^^']), String('^^^x'.match(/^\^+/)));
44
45 RegExp.multiline = true;
46 // 'abc\n123xyz'.match(new RegExp('^\d+')) <multiline==true>
47 new TestCase ( SECTION, "'abc\n123xyz'.match(new RegExp('^\\d+'))",
48 String(['123']), String('abc\n123xyz'.match(new RegExp('^\\d+'))));
49
50 test();