js/src/tests/js1_2/regexp/question_mark.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/. */
     7 /**
     8    Filename:     question_mark.js
     9    Description:  'Tests regular expressions containing ?'
    11    Author:       Nick Lerissa
    12    Date:         March 10, 1998
    13 */
    15 var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
    16 var VERSION = 'no version';
    17 startTest();
    18 var TITLE   = 'RegExp: ?';
    20 writeHeaderToLog('Executing script: question_mark.js');
    21 writeHeaderToLog( SECTION + " "+ TITLE);
    23 // 'abcdef'.match(new RegExp('cd?e'))
    24 new TestCase ( SECTION, "'abcdef'.match(new RegExp('cd?e'))",
    25 	       String(["cde"]), String('abcdef'.match(new RegExp('cd?e'))));
    27 // 'abcdef'.match(new RegExp('cdx?e'))
    28 new TestCase ( SECTION, "'abcdef'.match(new RegExp('cdx?e'))",
    29 	       String(["cde"]), String('abcdef'.match(new RegExp('cdx?e'))));
    31 // 'pqrstuvw'.match(new RegExp('o?pqrst'))
    32 new TestCase ( SECTION, "'pqrstuvw'.match(new RegExp('o?pqrst'))",
    33 	       String(["pqrst"]), String('pqrstuvw'.match(new RegExp('o?pqrst'))));
    35 // 'abcd'.match(new RegExp('x?y?z?'))
    36 new TestCase ( SECTION, "'abcd'.match(new RegExp('x?y?z?'))",
    37 	       String([""]), String('abcd'.match(new RegExp('x?y?z?'))));
    39 // 'abcd'.match(new RegExp('x?ay?bz?c'))
    40 new TestCase ( SECTION, "'abcd'.match(new RegExp('x?ay?bz?c'))",
    41 	       String(["abc"]), String('abcd'.match(new RegExp('x?ay?bz?c'))));
    43 // 'abcd'.match(/x?ay?bz?c/)
    44 new TestCase ( SECTION, "'abcd'.match(/x?ay?bz?c/)",
    45 	       String(["abc"]), String('abcd'.match(/x?ay?bz?c/)));
    47 // 'abbbbc'.match(new RegExp('b?b?b?b'))
    48 new TestCase ( SECTION, "'abbbbc'.match(new RegExp('b?b?b?b'))",
    49 	       String(["bbbb"]), String('abbbbc'.match(new RegExp('b?b?b?b'))));
    51 // '123az789'.match(new RegExp('ab?c?d?x?y?z'))
    52 new TestCase ( SECTION, "'123az789'.match(new RegExp('ab?c?d?x?y?z'))",
    53 	       String(["az"]), String('123az789'.match(new RegExp('ab?c?d?x?y?z'))));
    55 // '123az789'.match(/ab?c?d?x?y?z/)
    56 new TestCase ( SECTION, "'123az789'.match(/ab?c?d?x?y?z/)",
    57 	       String(["az"]), String('123az789'.match(/ab?c?d?x?y?z/)));
    59 // '?????'.match(new RegExp('\\??\\??\\??\\??\\??'))
    60 new TestCase ( SECTION, "'?????'.match(new RegExp('\\??\\??\\??\\??\\??'))",
    61 	       String(["?????"]), String('?????'.match(new RegExp('\\??\\??\\??\\??\\??'))));
    63 // 'test'.match(new RegExp('.?.?.?.?.?.?.?'))
    64 new TestCase ( SECTION, "'test'.match(new RegExp('.?.?.?.?.?.?.?'))",
    65 	       String(["test"]), String('test'.match(new RegExp('.?.?.?.?.?.?.?'))));
    67 test();

mercurial