1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/ecma_2/RegExp/regress-001.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,45 @@ 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 + * File Name: RegExp/regress-001.js 1.12 + * ECMA Section: N/A 1.13 + * Description: Regression test case: 1.14 + * JS regexp anchoring on empty match bug 1.15 + * http://bugzilla.mozilla.org/show_bug.cgi?id=2157 1.16 + * 1.17 + * Author: christine@netscape.com 1.18 + * Date: 19 February 1999 1.19 + */ 1.20 +var SECTION = "RegExp/hex-001.js"; 1.21 +var VERSION = "ECMA_2"; 1.22 +var TITLE = "JS regexp anchoring on empty match bug"; 1.23 +var BUGNUMBER = "2157"; 1.24 + 1.25 +startTest(); 1.26 + 1.27 +AddRegExpCases( /a||b/.exec(''), 1.28 + "/a||b/.exec('')", 1.29 + 1, 1.30 + [''] ); 1.31 + 1.32 +test(); 1.33 + 1.34 +function AddRegExpCases( regexp, str_regexp, length, matches_array ) { 1.35 + 1.36 + AddTestCase( 1.37 + "( " + str_regexp + " ).length", 1.38 + regexp.length, 1.39 + regexp.length ); 1.40 + 1.41 + 1.42 + for ( var matches = 0; matches < matches_array.length; matches++ ) { 1.43 + AddTestCase( 1.44 + "( " + str_regexp + " )[" + matches +"]", 1.45 + matches_array[matches], 1.46 + regexp[matches] ); 1.47 + } 1.48 +}