js/src/tests/js1_2/regexp/source.js

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:88dc34f8082c
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
7 /**
8 Filename: source.js
9 Description: 'Tests RegExp attribute source'
10
11 Author: Nick Lerissa
12 Date: March 13, 1998
13 */
14
15 var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
16 var VERSION = 'no version';
17 startTest();
18 var TITLE = 'RegExp: source';
19
20 writeHeaderToLog('Executing script: source.js');
21 writeHeaderToLog( SECTION + " "+ TITLE);
22
23
24 // /xyz/g.source
25 new TestCase ( SECTION, "/xyz/g.source",
26 "xyz", /xyz/g.source);
27
28 // /xyz/.source
29 new TestCase ( SECTION, "/xyz/.source",
30 "xyz", /xyz/.source);
31
32 // /abc\\def/.source
33 new TestCase ( SECTION, "/abc\\\\def/.source",
34 "abc\\\\def", /abc\\def/.source);
35
36 // /abc[\b]def/.source
37 new TestCase ( SECTION, "/abc[\\b]def/.source",
38 "abc[\\b]def", /abc[\b]def/.source);
39
40 // (new RegExp('xyz')).source
41 new TestCase ( SECTION, "(new RegExp('xyz')).source",
42 "xyz", (new RegExp('xyz')).source);
43
44 // (new RegExp('xyz','g')).source
45 new TestCase ( SECTION, "(new RegExp('xyz','g')).source",
46 "xyz", (new RegExp('xyz','g')).source);
47
48 // (new RegExp('abc\\\\def')).source
49 new TestCase ( SECTION, "(new RegExp('abc\\\\\\\\def')).source",
50 "abc\\\\def", (new RegExp('abc\\\\def')).source);
51
52 // (new RegExp('abc[\\b]def')).source
53 new TestCase ( SECTION, "(new RegExp('abc[\\\\b]def')).source",
54 "abc[\\b]def", (new RegExp('abc[\\b]def')).source);
55
56 test();

mercurial