1 /* ***** BEGIN LICENSE BLOCK *****
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 * The contents of this file are subject to the Mozilla Public License Version
5 * 1.1 (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 * http://www.mozilla.org/MPL/
9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 * for the specific language governing rights and limitations under the
14 * The Original Code is mozilla.org code.
16 * The Initial Developer of the Original Code is
17 * Netscape Communications Corporation.
18 * Portions created by the Initial Developer are Copyright (C) 1998
19 * the Initial Developer. All Rights Reserved.
22 * brendan@mozilla.org, pschwartau@netscape.com
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
37 //-----------------------------------------------------------------------------
40 var summary = 'Regression test for Bugzilla bug 99663';
42 * This testcase expects error messages containing
43 * the phrase 'read-only' or something similar -
45 var READONLY = /read\s*-?\s*only/;
46 var READONLY_TRUE = 'a "read-only" error';
47 var READONLY_FALSE = 'Error: ';
48 var FAILURE = 'NO ERROR WAS GENERATED!';
53 var expectedvalues = [];
54 var actualvalues = [];
58 * These MUST be compiled in JS1.2 or less for the test to work - see above
71 for (it.rdonly in this);
83 * Begin testing by capturing actual vs. expected values.
84 * Initialize to FAILURE; this will get reset if all goes well -
93 actual = readOnly(e.message);
95 expect= READONLY_TRUE;
96 status = 'Section 1 of test - got ' + actual;
107 actual = readOnly(e.message);
109 expect= READONLY_TRUE;
110 status = 'Section 2 of test - got ' + actual;
121 actual = readOnly(e.message);
123 expect= READONLY_TRUE;
124 status = 'Section 3 of test - got ' + actual;
129 //-----------------------------------------------------------------------------
131 //-----------------------------------------------------------------------------
135 function readOnly(msg)
137 if (msg.match(READONLY))
138 return READONLY_TRUE;
139 return READONLY_FALSE + msg;
145 statusitems[UBound] = status;
146 actualvalues[UBound] = actual;
147 expectedvalues[UBound] = expect;
154 writeLineToLog ('Bug Number ' + bug);
155 writeLineToLog ('STATUS: ' + summary);
157 for (var i=0; i<UBound; i++)
159 writeTestCaseResult(expectedvalues[i], actualvalues[i], statusitems[i]);