Debian Codegraph @

rhino/testsrc/tests/js1_2/regexp/RegExp_leftContext_as_array.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 = 'RegExp_leftContext_as_array.js';
7
8 /**
9 Filename: RegExp_leftContext_as_array.js
10 Description: 'Tests RegExps leftContext property (same tests as RegExp_leftContext.js but using $`)'
11
12 Author: Nick Lerissa
13 Date: March 12, 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: RegExp_leftContext_as_array.js');
22 writeHeaderToLog( SECTION + " "+ TITLE);
23
24 // 'abc123xyz'.match(/123/); RegExp['$`']
25 'abc123xyz'.match(/123/);
26 new TestCase ( SECTION, "'abc123xyz'.match(/123/); RegExp['$`']",
27 'abc', RegExp['$`']);
28
29 // 'abc123xyz'.match(/456/); RegExp['$`']
30 'abc123xyz'.match(/456/);
31 new TestCase ( SECTION, "'abc123xyz'.match(/456/); RegExp['$`']",
32 'abc', RegExp['$`']);
33
34 // 'abc123xyz'.match(/abc123xyz/); RegExp['$`']
35 'abc123xyz'.match(/abc123xyz/);
36 new TestCase ( SECTION, "'abc123xyz'.match(/abc123xyz/); RegExp['$`']",
37 '', RegExp['$`']);
38
39 // 'xxxx'.match(/$/); RegExp['$`']
40 'xxxx'.match(/$/);
41 new TestCase ( SECTION, "'xxxx'.match(/$/); RegExp['$`']",
42 'xxxx', RegExp['$`']);
43
44 // 'test'.match(/^/); RegExp['$`']
45 'test'.match(/^/);
46 new TestCase ( SECTION, "'test'.match(/^/); RegExp['$`']",
47 '', RegExp['$`']);
48
49 // 'xxxx'.match(new RegExp('$')); RegExp['$`']
50 'xxxx'.match(new RegExp('$'));
51 new TestCase ( SECTION, "'xxxx'.match(new RegExp('$')); RegExp['$`']",
52 'xxxx', RegExp['$`']);
53
54 // 'test'.match(new RegExp('^')); RegExp['$`']
55 'test'.match(new RegExp('^'));
56 new TestCase ( SECTION, "'test'.match(new RegExp('^')); RegExp['$`']",
57 '', RegExp['$`']);
58
59 test();