initial import
[vuplus_webkit] / Source / JavaScriptCore / tests / mozilla / ecma_2 / Exceptions / function-001.js
1 /**
2  *  File Name:          boolean-001.js
3  *  Description:
4  *
5  *  http://scopus.mcom.com/bugsplat/show_bug.cgi?id=99232
6  *
7  *  eval("function f(){}function g(){}") at top level is an error for JS1.2
8  *     and above (missing ; between named function expressions), but declares f
9  *     and g as functions below 1.2.
10  *
11  * Fails to produce error regardless of version:
12  * js> version(100)
13  * 120
14  * js> eval("function f(){}function g(){}")
15  * js> version(120);
16  * 100
17  * js> eval("function f(){}function g(){}")
18  * js>
19  *  Author:             christine@netscape.com
20  *  Date:               11 August 1998
21  */
22     var SECTION = "function-001.js";
23     var VERSION = "JS_12";
24     var TITLE   = "functions not separated by semicolons are errors in version 120 and higher";
25     var BUGNUMBER="10278";
26
27     startTest();
28     writeHeaderToLog( SECTION + " "+ TITLE);
29
30     var tc = 0;
31     var testcases = new Array();
32
33     var result = "fail";
34     var exception = "no exception thrown";
35
36     try {
37         eval("function f(){}function g(){}");
38     } catch ( e ) {
39         result = "pass"
40         exception = e.toString();
41     }
42
43     testcases[tc++] = new TestCase(
44         SECTION,
45         "eval(\"function f(){}function g(){}\") (threw "+exception,
46         "pass",
47         result );
48
49     test();
50
51
52 function test() {
53     for ( tc=0; tc < testcases.length; tc++ ) {
54         testcases[tc].passed = writeTestCaseResult(
55                             testcases[tc].expect,
56                             testcases[tc].actual,
57                             testcases[tc].description +" = "+
58                             testcases[tc].actual );
59
60         testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
61     }
62     stopTest();
63     return ( testcases );
64 }