js/src/tests/ecma_3/RegExp/regress-225343.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-225343.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,91 @@
     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 + * Date:    11 November 2003
    1.12 + * SUMMARY: Testing regexp character classes and the case-insensitive flag
    1.13 + *
    1.14 + * See http://bugzilla.mozilla.org/show_bug.cgi?id=225343
    1.15 + *
    1.16 + */
    1.17 +//-----------------------------------------------------------------------------
    1.18 +var i = 0;
    1.19 +var BUGNUMBER = 225343;
    1.20 +var summary = 'Testing regexp character classes and the case-insensitive flag';
    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 +status = inSection(1);
    1.34 +string = 'a';
    1.35 +pattern = /[A]/i;
    1.36 +actualmatch = string.match(pattern);
    1.37 +expectedmatch = Array('a');
    1.38 +addThis();
    1.39 +
    1.40 +status = inSection(2);
    1.41 +string = 'A';
    1.42 +pattern = /[a]/i;
    1.43 +actualmatch = string.match(pattern);
    1.44 +expectedmatch = Array('A');
    1.45 +addThis();
    1.46 +
    1.47 +status = inSection(3);
    1.48 +string = '123abc123';
    1.49 +pattern = /([A-Z]+)/i;
    1.50 +actualmatch = string.match(pattern);
    1.51 +expectedmatch = Array('abc', 'abc');
    1.52 +addThis();
    1.53 +
    1.54 +status = inSection(4);
    1.55 +string = '123abc123';
    1.56 +pattern = /([A-Z])+/i;
    1.57 +actualmatch = string.match(pattern);
    1.58 +expectedmatch = Array('abc', 'c');
    1.59 +addThis();
    1.60 +
    1.61 +status = inSection(5);
    1.62 +string = 'abc@test.com';
    1.63 +pattern = /^[-!#$%&\'*+\.\/0-9=?A-Z^_`{|}~]+@([-0-9A-Z]+\.)+([0-9A-Z]){2,4}$/i;
    1.64 +actualmatch = string.match(pattern);
    1.65 +expectedmatch = Array('abc@test.com', 'test.', 'm');
    1.66 +addThis();
    1.67 +
    1.68 +
    1.69 +
    1.70 +//-------------------------------------------------------------------------------------------------
    1.71 +test();
    1.72 +//-------------------------------------------------------------------------------------------------
    1.73 +
    1.74 +
    1.75 +
    1.76 +function addThis()
    1.77 +{
    1.78 +  statusmessages[i] = status;
    1.79 +  patterns[i] = pattern;
    1.80 +  strings[i] = string;
    1.81 +  actualmatches[i] = actualmatch;
    1.82 +  expectedmatches[i] = expectedmatch;
    1.83 +  i++;
    1.84 +}
    1.85 +
    1.86 +
    1.87 +function test()
    1.88 +{
    1.89 +  enterFunc ('test');
    1.90 +  printBugNumber(BUGNUMBER);
    1.91 +  printStatus (summary);
    1.92 +  testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
    1.93 +  exitFunc ('test');
    1.94 +}

mercurial