1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
\r
2 /* ***** BEGIN LICENSE BLOCK *****
\r
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
\r
5 * The contents of this file are subject to the Mozilla Public License Version
\r
6 * 1.1 (the "License"); you may not use this file except in compliance with
\r
7 * the License. You may obtain a copy of the License at
\r
8 * http://www.mozilla.org/MPL/
\r
10 * Software distributed under the License is distributed on an "AS IS" basis,
\r
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
\r
12 * for the specific language governing rights and limitations under the
\r
15 * The Original Code is Mozilla Communicator client code, released
\r
18 * The Initial Developer of the Original Code is
\r
19 * Netscape Communications Corporation.
\r
20 * Portions created by the Initial Developer are Copyright (C) 1998
\r
21 * the Initial Developer. All Rights Reserved.
\r
25 * Alternatively, the contents of this file may be used under the terms of
\r
26 * either the GNU General Public License Version 2 or later (the "GPL"), or
\r
27 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
\r
28 * in which case the provisions of the GPL or the LGPL are applicable instead
\r
29 * of those above. If you wish to allow use of your version of this file only
\r
30 * under the terms of either the GPL or the LGPL, and not to allow others to
\r
31 * use your version of this file under the terms of the MPL, indicate your
\r
32 * decision by deleting the provisions above and replace them with the notice
\r
33 * and other provisions required by the GPL or the LGPL. If you do not delete
\r
34 * the provisions above, a recipient may use your version of this file under
\r
35 * the terms of any one of the MPL, the GPL or the LGPL.
\r
37 * ***** END LICENSE BLOCK ***** */
\r
40 Filename: ignoreCase.js
\r
41 Description: 'Tests RegExp attribute ignoreCase'
\r
43 Author: Nick Lerissa
\r
44 Date: March 13, 1998
\r
47 var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
\r
48 var VERSION = 'no version';
\r
50 var TITLE = 'RegExp: ignoreCase';
\r
52 writeHeaderToLog('Executing script: ignoreCase.js');
\r
53 writeHeaderToLog( SECTION + " "+ TITLE);
\r
56 // /xyz/i.ignoreCase
\r
57 new TestCase ( SECTION, "/xyz/i.ignoreCase",
\r
58 true, /xyz/i.ignoreCase);
\r
61 new TestCase ( SECTION, "/xyz/.ignoreCase",
\r
62 false, /xyz/.ignoreCase);
\r
64 // 'ABC def ghi'.match(/[a-z]+/ig)
\r
65 new TestCase ( SECTION, "'ABC def ghi'.match(/[a-z]+/ig)",
\r
66 String(["ABC","def","ghi"]), String('ABC def ghi'.match(/[a-z]+/ig)));
\r
68 // 'ABC def ghi'.match(/[a-z]+/i)
\r
69 new TestCase ( SECTION, "'ABC def ghi'.match(/[a-z]+/i)",
\r
70 String(["ABC"]), String('ABC def ghi'.match(/[a-z]+/i)));
\r
72 // 'ABC def ghi'.match(/([a-z]+)/ig)
\r
73 new TestCase ( SECTION, "'ABC def ghi'.match(/([a-z]+)/ig)",
\r
74 String(["ABC","def","ghi"]), String('ABC def ghi'.match(/([a-z]+)/ig)));
\r
76 // 'ABC def ghi'.match(/([a-z]+)/i)
\r
77 new TestCase ( SECTION, "'ABC def ghi'.match(/([a-z]+)/i)",
\r
78 String(["ABC","ABC"]), String('ABC def ghi'.match(/([a-z]+)/i)));
\r
80 // 'ABC def ghi'.match(/[a-z]+/)
\r
81 new TestCase ( SECTION, "'ABC def ghi'.match(/[a-z]+/)",
\r
82 String(["def"]), String('ABC def ghi'.match(/[a-z]+/)));
\r
84 // (new RegExp('xyz','i')).ignoreCase
\r
85 new TestCase ( SECTION, "(new RegExp('xyz','i')).ignoreCase",
\r
86 true, (new RegExp('xyz','i')).ignoreCase);
\r
88 // (new RegExp('xyz')).ignoreCase
\r
89 new TestCase ( SECTION, "(new RegExp('xyz')).ignoreCase",
\r
90 false, (new RegExp('xyz')).ignoreCase);
\r
92 // 'ABC def ghi'.match(new RegExp('[a-z]+','ig'))
\r
93 new TestCase ( SECTION, "'ABC def ghi'.match(new RegExp('[a-z]+','ig'))",
\r
94 String(["ABC","def","ghi"]), String('ABC def ghi'.match(new RegExp('[a-z]+','ig'))));
\r
96 // 'ABC def ghi'.match(new RegExp('[a-z]+','i'))
\r
97 new TestCase ( SECTION, "'ABC def ghi'.match(new RegExp('[a-z]+','i'))",
\r
98 String(["ABC"]), String('ABC def ghi'.match(new RegExp('[a-z]+','i'))));
\r
100 // 'ABC def ghi'.match(new RegExp('([a-z]+)','ig'))
\r
101 new TestCase ( SECTION, "'ABC def ghi'.match(new RegExp('([a-z]+)','ig'))",
\r
102 String(["ABC","def","ghi"]), String('ABC def ghi'.match(new RegExp('([a-z]+)','ig'))));
\r
104 // 'ABC def ghi'.match(new RegExp('([a-z]+)','i'))
\r
105 new TestCase ( SECTION, "'ABC def ghi'.match(new RegExp('([a-z]+)','i'))",
\r
106 String(["ABC","ABC"]), String('ABC def ghi'.match(new RegExp('([a-z]+)','i'))));
\r
108 // 'ABC def ghi'.match(new RegExp('[a-z]+'))
\r
109 new TestCase ( SECTION, "'ABC def ghi'.match(new RegExp('[a-z]+'))",
\r
110 String(["def"]), String('ABC def ghi'.match(new RegExp('[a-z]+'))));
\r