Debian Codegraph @

rhino/testsrc/tests/js1_2/regexp/source.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 = 'source.js';
7
8 /**
9 Filename: source.js
10 Description: 'Tests RegExp attribute source'
11
12 Author: Nick Lerissa
13 Date: March 13, 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: source';
20
21 writeHeaderToLog('Executing script: source.js');
22 writeHeaderToLog( SECTION + " "+ TITLE);
23
24
25 // /xyz/g.source
26 new TestCase ( SECTION, "/xyz/g.source",
27 "xyz", /xyz/g.source);
28
29 // /xyz/.source
30 new TestCase ( SECTION, "/xyz/.source",
31 "xyz", /xyz/.source);
32
33 // /abc\\def/.source
34 new TestCase ( SECTION, "/abc\\\\def/.source",
35 "abc\\\\def", /abc\\def/.source);
36
37 // /abc[\b]def/.source
38 new TestCase ( SECTION, "/abc[\\b]def/.source",
39 "abc[\\b]def", /abc[\b]def/.source);
40
41 // (new RegExp('xyz')).source
42 new TestCase ( SECTION, "(new RegExp('xyz')).source",
43 "xyz", (new RegExp('xyz')).source);
44
45 // (new RegExp('xyz','g')).source
46 new TestCase ( SECTION, "(new RegExp('xyz','g')).source",
47 "xyz", (new RegExp('xyz','g')).source);
48
49 // (new RegExp('abc\\\\def')).source
50 new TestCase ( SECTION, "(new RegExp('abc\\\\\\\\def')).source",
51 "abc\\\\def", (new RegExp('abc\\\\def')).source);
52
53 // (new RegExp('abc[\\b]def')).source
54 new TestCase ( SECTION, "(new RegExp('abc[\\\\b]def')).source",
55 "abc[\\b]def", (new RegExp('abc[\\b]def')).source);
56
57 test();