Debian Codegraph @

rhino/testsrc/tests/js1_2/regexp/backspace.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 = 'backspace.js';
7
8 /**
9 Filename: backspace.js
10 Description: 'Tests regular expressions containing [\b]'
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: [\b]';
20
21 writeHeaderToLog('Executing script: backspace.js');
22 writeHeaderToLog( SECTION + " "+ TITLE);
23
24 // 'abc\bdef'.match(new RegExp('.[\b].'))
25 new TestCase ( SECTION, "'abc\bdef'.match(new RegExp('.[\\b].'))",
26 String(["c\bd"]), String('abc\bdef'.match(new RegExp('.[\\b].'))));
27
28 // 'abc\\bdef'.match(new RegExp('.[\b].'))
29 new TestCase ( SECTION, "'abc\\bdef'.match(new RegExp('.[\\b].'))",
30 null, 'abc\\bdef'.match(new RegExp('.[\\b].')));
31
32 // 'abc\b\b\bdef'.match(new RegExp('c[\b]{3}d'))
33 new TestCase ( SECTION, "'abc\b\b\bdef'.match(new RegExp('c[\\b]{3}d'))",
34 String(["c\b\b\bd"]), String('abc\b\b\bdef'.match(new RegExp('c[\\b]{3}d'))));
35
36 // 'abc\bdef'.match(new RegExp('[^\\[\b\\]]+'))
37 new TestCase ( SECTION, "'abc\bdef'.match(new RegExp('[^\\[\\b\\]]+'))",
38 String(["abc"]), String('abc\bdef'.match(new RegExp('[^\\[\\b\\]]+'))));
39
40 // 'abcdef'.match(new RegExp('[^\\[\b\\]]+'))
41 new TestCase ( SECTION, "'abcdef'.match(new RegExp('[^\\[\\b\\]]+'))",
42 String(["abcdef"]), String('abcdef'.match(new RegExp('[^\\[\\b\\]]+'))));
43
44 // 'abcdef'.match(/[^\[\b\]]+/)
45 new TestCase ( SECTION, "'abcdef'.match(/[^\\[\\b\\]]+/)",
46 String(["abcdef"]), String('abcdef'.match(/[^\[\b\]]+/)));
47
48 test();