RegExp_rightContext.js (1908B)
1 /* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 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: RegExp_rightContext.js 9 Description: 'Tests RegExps rightContext property' 10 11 Author: Nick Lerissa 12 Date: March 12, 1998 13 */ 14 15 var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; 16 var TITLE = 'RegExp: rightContext'; 17 18 writeHeaderToLog('Executing script: RegExp_rightContext.js'); 19 writeHeaderToLog( SECTION + " "+ TITLE); 20 21 // 'abc123xyz'.match(/123/); RegExp.rightContext 22 'abc123xyz'.match(/123/); 23 new TestCase ( "'abc123xyz'.match(/123/); RegExp.rightContext", 24 'xyz', RegExp.rightContext); 25 26 // 'abc123xyz'.match(/456/); RegExp.rightContext 27 'abc123xyz'.match(/456/); 28 new TestCase ( "'abc123xyz'.match(/456/); RegExp.rightContext", 29 'xyz', RegExp.rightContext); 30 31 // 'abc123xyz'.match(/abc123xyz/); RegExp.rightContext 32 'abc123xyz'.match(/abc123xyz/); 33 new TestCase ( "'abc123xyz'.match(/abc123xyz/); RegExp.rightContext", 34 '', RegExp.rightContext); 35 36 // 'xxxx'.match(/$/); RegExp.rightContext 37 'xxxx'.match(/$/); 38 new TestCase ( "'xxxx'.match(/$/); RegExp.rightContext", 39 '', RegExp.rightContext); 40 41 // 'test'.match(/^/); RegExp.rightContext 42 'test'.match(/^/); 43 new TestCase ( "'test'.match(/^/); RegExp.rightContext", 44 'test', RegExp.rightContext); 45 46 // 'xxxx'.match(new RegExp('$')); RegExp.rightContext 47 'xxxx'.match(new RegExp('$')); 48 new TestCase ( "'xxxx'.match(new RegExp('$')); RegExp.rightContext", 49 '', RegExp.rightContext); 50 51 // 'test'.match(new RegExp('^')); RegExp.rightContext 52 'test'.match(new RegExp('^')); 53 new TestCase ( "'test'.match(new RegExp('^')); RegExp.rightContext", 54 'test', RegExp.rightContext); 55 56 test();