1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/ecma_2/Exceptions/function-001.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,53 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 + 1.10 +/** 1.11 + * File Name: boolean-001.js 1.12 + * Description: 1.13 + * 1.14 + * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=99232 1.15 + * 1.16 + * eval("function f(){}function g(){}") at top level is an error for JS1.2 1.17 + * and above (missing ; between named function expressions), but declares f 1.18 + * and g as functions below 1.2. 1.19 + * 1.20 + * Fails to produce error regardless of version: 1.21 + * js> version(100) 1.22 + * 120 1.23 + * js> eval("function f(){}function g(){}") 1.24 + * js> version(120); 1.25 + * 100 1.26 + * js> eval("function f(){}function g(){}") 1.27 + * js> 1.28 + * Author: christine@netscape.com 1.29 + * Date: 11 August 1998 1.30 + */ 1.31 +var SECTION = "function-001.js"; 1.32 +var VERSION = "JS_12"; 1.33 +var TITLE = "functions not separated by semicolons are errors in version 120 and higher"; 1.34 +var BUGNUMBER="10278"; 1.35 + 1.36 +startTest(); 1.37 +writeHeaderToLog( SECTION + " "+ TITLE); 1.38 + 1.39 +var result = "pass"; 1.40 +var exception = "no exception thrown"; 1.41 + 1.42 +try { 1.43 + eval("function f(){}function g(){}"); 1.44 +} catch ( e ) { 1.45 + result = "fail"; 1.46 + exception = e.toString(); 1.47 +} 1.48 + 1.49 +new TestCase( 1.50 + SECTION, 1.51 + "eval(\"function f(){}function g(){}\") (threw "+exception, 1.52 + "pass", 1.53 + result ); 1.54 + 1.55 +test(); 1.56 +