]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/ecma/browser.js
2 * The contents of this file are subject to the Netscape Public
3 * License Version 1.1 (the "License"); you may not use this file
4 * except in compliance with the License. You may obtain a copy of
5 * the License at http://www.mozilla.org/NPL/
7 * Software distributed under the License is distributed on an "AS
8 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
9 * implied. See the License for the specific language governing
10 * rights and limitations under the License.
12 * The Original Code is mozilla.org code.
14 * The Initial Developer of the Original Code is Netscape
15 * Communications Corporation. Portions created by Netscape are
16 * Copyright (C) 1998 Netscape Communications Corporation. All
23 * JavaScript test library shared functions file for running the tests
24 * in the browser. Overrides the shell's print function with document.write
25 * and make everything HTML pretty.
27 * To run the tests in the browser, use the mkhtml.pl script to generate
28 * html pages that include the shell.js, browser.js (this file), and the
29 * test js file in script tags.
31 * The source of the page that is generated should look something like this:
32 * <script src="./../shell.js"></script>
33 * <script src="./../browser.js"></script>
34 * <script src="./mytest.js"></script>
39 function startTest() {
41 writeLineToLog ("BUGNUMBER: " + BUGNUMBER
);
44 testcases
= new Array();
48 function writeLineToLog( string
) {
49 document
.write( string
+ "<br>\n");
51 function writeHeaderToLog( string
) {
52 document
.write( "<h2>" + string
+ "</h2>" );
56 if ( gc
!= undefined ) {
59 document
.write( "<hr>" );
61 function writeFormattedResult( expect
, actual
, string
, passed
) {
62 var s
= "<tt>"+ string
;
64 s
+= ( passed
) ? "<font color=#009900> " + PASSED
65 : "<font color=#aa0000> " + FAILED
+ expect
+ "</tt>";
66 writeLineToLog( s
+ "</font></b></tt>" );
69 function err( msg
, page
, line
) {
70 writeLineToLog( "Test failed with the message: " + msg
);
72 testcases
[tc
].actual
= "error";
73 testcases
[tc
].reason
= msg
;
74 writeTestCaseResult( testcases
[tc
].expect
,
76 testcases
[tc
].description
+" = "+ testcases
[tc
].actual
+
77 ": " + testcases
[tc
].reason
);