Debian Codegraph @

rhino/testsrc/tests/js1_2/regexp/exec.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 = 'exec.js';
7
8 /**
9 Filename: exec.js
10 Description: 'Tests regular expressions exec compile'
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: exec';
20
21 writeHeaderToLog('Executing script: exec.js');
22 writeHeaderToLog( SECTION + " "+ TITLE);
23
24 new TestCase ( SECTION,
25 "/[0-9]{3}/.exec('23 2 34 678 9 09')",
26 String(["678"]), String(/[0-9]{3}/.exec('23 2 34 678 9 09')));
27
28 new TestCase ( SECTION,
29 "/3.{4}8/.exec('23 2 34 678 9 09')",
30 String(["34 678"]), String(/3.{4}8/.exec('23 2 34 678 9 09')));
31
32 var re = new RegExp('3.{4}8');
33 new TestCase ( SECTION,
34 "re.exec('23 2 34 678 9 09')",
35 String(["34 678"]), String(re.exec('23 2 34 678 9 09')));
36
37 new TestCase ( SECTION,
38 "(/3.{4}8/.exec('23 2 34 678 9 09').length",
39 1, (/3.{4}8/.exec('23 2 34 678 9 09')).length);
40
41 re = new RegExp('3.{4}8');
42 new TestCase ( SECTION,
43 "(re.exec('23 2 34 678 9 09').length",
44 1, (re.exec('23 2 34 678 9 09')).length);
45
46 test();