michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: michael@0: /** michael@0: * File Name: regress-6359.js michael@0: * Reference: ** replace with bugzilla URL or document reference ** michael@0: * Description: ** replace with description of test ** michael@0: * Author: ** replace with your e-mail address ** michael@0: */ michael@0: michael@0: var SECTION = "js1_2"; // provide a document reference (ie, ECMA section) michael@0: var VERSION = "ECMA_2"; // Version of JavaScript or ECMA michael@0: var TITLE = "Regression test for bugzilla # 6359"; // Provide ECMA section title or a description michael@0: var BUGNUMBER = "http://bugzilla.mozilla.org/show_bug.cgi?id=6359"; // Provide URL to bugsplat or bugzilla report michael@0: michael@0: startTest(); // leave this alone michael@0: michael@0: /* michael@0: * Calls to AddTestCase here. AddTestCase is a function that is defined michael@0: * in shell.js and takes three arguments: michael@0: * - a string representation of what is being tested michael@0: * - the expected result michael@0: * - the actual result michael@0: * michael@0: * For example, a test might look like this: michael@0: * michael@0: * var zip = /[\d]{5}$/; michael@0: * michael@0: * AddTestCase( michael@0: * "zip = /[\d]{5}$/; \"PO Box 12345 Boston, MA 02134\".match(zip)", // description of the test michael@0: * "02134", // expected result michael@0: * "PO Box 12345 Boston, MA 02134".match(zip) ); // actual result michael@0: * michael@0: */ michael@0: michael@0: AddTestCase( '/(a*)b\1+/.exec("baaac").length', michael@0: 2, michael@0: /(a*)b\1+/.exec("baaac").length ); michael@0: michael@0: AddTestCase( '/(a*)b\1+/.exec("baaac")[0]', michael@0: "b", michael@0: /(a*)b\1+/.exec("baaac")[0]); michael@0: michael@0: AddTestCase( '/(a*)b\1+/.exec("baaac")[1]', michael@0: "", michael@0: /(a*)b\1+/.exec("baaac")[1]); michael@0: michael@0: michael@0: test(); // leave this alone. this executes the test cases and michael@0: // displays results.