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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 /*
     7  *
     8  * Date:    11 November 2003
     9  * SUMMARY: Testing regexp character classes and the case-insensitive flag
    10  *
    11  * See http://bugzilla.mozilla.org/show_bug.cgi?id=225343
    12  *
    13  */
    14 //-----------------------------------------------------------------------------
    15 var i = 0;
    16 var BUGNUMBER = 225343;
    17 var summary = 'Testing regexp character classes and the case-insensitive flag';
    18 var status = '';
    19 var statusmessages = new Array();
    20 var pattern = '';
    21 var patterns = new Array();
    22 var string = '';
    23 var strings = new Array();
    24 var actualmatch = '';
    25 var actualmatches = new Array();
    26 var expectedmatch = '';
    27 var expectedmatches = new Array();
    30 status = inSection(1);
    31 string = 'a';
    32 pattern = /[A]/i;
    33 actualmatch = string.match(pattern);
    34 expectedmatch = Array('a');
    35 addThis();
    37 status = inSection(2);
    38 string = 'A';
    39 pattern = /[a]/i;
    40 actualmatch = string.match(pattern);
    41 expectedmatch = Array('A');
    42 addThis();
    44 status = inSection(3);
    45 string = '123abc123';
    46 pattern = /([A-Z]+)/i;
    47 actualmatch = string.match(pattern);
    48 expectedmatch = Array('abc', 'abc');
    49 addThis();
    51 status = inSection(4);
    52 string = '123abc123';
    53 pattern = /([A-Z])+/i;
    54 actualmatch = string.match(pattern);
    55 expectedmatch = Array('abc', 'c');
    56 addThis();
    58 status = inSection(5);
    59 string = 'abc@test.com';
    60 pattern = /^[-!#$%&\'*+\.\/0-9=?A-Z^_`{|}~]+@([-0-9A-Z]+\.)+([0-9A-Z]){2,4}$/i;
    61 actualmatch = string.match(pattern);
    62 expectedmatch = Array('abc@test.com', 'test.', 'm');
    63 addThis();
    67 //-------------------------------------------------------------------------------------------------
    68 test();
    69 //-------------------------------------------------------------------------------------------------
    73 function addThis()
    74 {
    75   statusmessages[i] = status;
    76   patterns[i] = pattern;
    77   strings[i] = string;
    78   actualmatches[i] = actualmatch;
    79   expectedmatches[i] = expectedmatch;
    80   i++;
    81 }
    84 function test()
    85 {
    86   enterFunc ('test');
    87   printBugNumber(BUGNUMBER);
    88   printStatus (summary);
    89   testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
    90   exitFunc ('test');
    91 }

mercurial