js/src/tests/ecma_3/RegExp/regress-76683.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/ecma_3/RegExp/regress-76683.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,80 @@
     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 + * Date: 01 May 2001
    1.11 + *
    1.12 + * SUMMARY: Regression test for Bugzilla bug 76683 on Rhino:
    1.13 + * "RegExp regression (NullPointerException)"
    1.14 + *
    1.15 + * See http://bugzilla.mozilla.org/show_bug.cgi?id=76683
    1.16 + */
    1.17 +//-----------------------------------------------------------------------------
    1.18 +var i = 0;
    1.19 +var BUGNUMBER = 76683;
    1.20 +var summary = 'Regression test for Bugzilla bug 76683';
    1.21 +var status = '';
    1.22 +var statusmessages = new Array();
    1.23 +var pattern = '';
    1.24 +var patterns = new Array();
    1.25 +var string = '';
    1.26 +var strings = new Array();
    1.27 +var actualmatch = '';
    1.28 +var actualmatches = new Array();
    1.29 +var expectedmatch = '';
    1.30 +var expectedmatches = new Array();
    1.31 +
    1.32 +
    1.33 +/*
    1.34 + * Rhino (2001-04-19) crashed on the 3rd regular expression below.
    1.35 + * It didn't matter what the string was. No problem in SpiderMonkey -
    1.36 + */
    1.37 +string = 'abc';
    1.38 +status = inSection(1);
    1.39 +pattern = /(<!--([^-]|-[^-]|--[^>])*-->)|(<([\$\w:\.\-]+)((([ ][^\/>]*)?\/>)|(([ ][^>]*)?>)))/;
    1.40 +actualmatch = string.match(pattern);
    1.41 +expectedmatch = null;
    1.42 +addThis();
    1.43 +
    1.44 +status = inSection(2);
    1.45 +pattern = /(<!--([^-]|-[^-]|--[^>])*-->)|(<(tagPattern)((([ ][^\/>]*)?\/>)|(([ ][^>]*)?>)))/;
    1.46 +actualmatch = string.match(pattern);
    1.47 +expectedmatch = null;
    1.48 +addThis();
    1.49 +
    1.50 +// This was the one causing a Rhino crash -
    1.51 +status = inSection(3);
    1.52 +pattern = /(<!--([^-]|-[^-]|--[^>])*-->)|(<(tagPattern)((([ ][^\/>]*)?\/>)|(([ ][^>]*)?>)))|(<\/tagPattern[^>]*>)/;
    1.53 +actualmatch = string.match(pattern);
    1.54 +expectedmatch = null;
    1.55 +addThis();
    1.56 +
    1.57 +
    1.58 +
    1.59 +//-------------------------------------------------------------------------------------------------
    1.60 +test();
    1.61 +//-------------------------------------------------------------------------------------------------
    1.62 +
    1.63 +
    1.64 +
    1.65 +function addThis()
    1.66 +{
    1.67 +  statusmessages[i] = status;
    1.68 +  patterns[i] = pattern;
    1.69 +  strings[i] = string;
    1.70 +  actualmatches[i] = actualmatch;
    1.71 +  expectedmatches[i] = expectedmatch;
    1.72 +  i++;
    1.73 +}
    1.74 +
    1.75 +
    1.76 +function test()
    1.77 +{
    1.78 +  enterFunc ('test');
    1.79 +  printBugNumber(BUGNUMBER);
    1.80 +  printStatus (summary);
    1.81 +  testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
    1.82 +  exitFunc ('test');
    1.83 +}

mercurial