1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/js1_2/regexp/beginLine.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,49 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 + 1.10 +/** 1.11 + Filename: beginLine.js 1.12 + Description: 'Tests regular expressions containing ^' 1.13 + 1.14 + Author: Nick Lerissa 1.15 + Date: March 10, 1998 1.16 +*/ 1.17 + 1.18 +var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; 1.19 +var VERSION = 'no version'; 1.20 +startTest(); 1.21 +var TITLE = 'RegExp: ^'; 1.22 + 1.23 +writeHeaderToLog('Executing script: beginLine.js'); 1.24 +writeHeaderToLog( SECTION + " "+ TITLE); 1.25 + 1.26 + 1.27 +// 'abcde'.match(new RegExp('^ab')) 1.28 +new TestCase ( SECTION, "'abcde'.match(new RegExp('^ab'))", 1.29 + String(["ab"]), String('abcde'.match(new RegExp('^ab')))); 1.30 + 1.31 +// 'ab\ncde'.match(new RegExp('^..^e')) 1.32 +new TestCase ( SECTION, "'ab\ncde'.match(new RegExp('^..^e'))", 1.33 + null, 'ab\ncde'.match(new RegExp('^..^e'))); 1.34 + 1.35 +// 'yyyyy'.match(new RegExp('^xxx')) 1.36 +new TestCase ( SECTION, "'yyyyy'.match(new RegExp('^xxx'))", 1.37 + null, 'yyyyy'.match(new RegExp('^xxx'))); 1.38 + 1.39 +// '^^^x'.match(new RegExp('^\\^+')) 1.40 +new TestCase ( SECTION, "'^^^x'.match(new RegExp('^\\^+'))", 1.41 + String(['^^^']), String('^^^x'.match(new RegExp('^\\^+')))); 1.42 + 1.43 +// '^^^x'.match(/^\^+/) 1.44 +new TestCase ( SECTION, "'^^^x'.match(/^\\^+/)", 1.45 + String(['^^^']), String('^^^x'.match(/^\^+/))); 1.46 + 1.47 +RegExp.multiline = true; 1.48 +// 'abc\n123xyz'.match(new RegExp('^\d+')) <multiline==true> 1.49 +new TestCase ( SECTION, "'abc\n123xyz'.match(new RegExp('^\\d+'))", 1.50 + String(['123']), String('abc\n123xyz'.match(new RegExp('^\\d+')))); 1.51 + 1.52 +test();