1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/ecma_2/Exceptions/lexical-030.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,59 @@ 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: lexical-030.js 1.12 + Corresponds To: 7.4.2-7-n.js 1.13 + ECMA Section: 7.4.2 1.14 + 1.15 + Description: 1.16 + The following tokens are ECMAScript keywords and may not be used as 1.17 + identifiers in ECMAScript programs. 1.18 + 1.19 + Syntax 1.20 + 1.21 + Keyword :: one of 1.22 + break for new var 1.23 + continue function return void 1.24 + delete if this while 1.25 + else in typeof with 1.26 + 1.27 + This test verifies that the keyword cannot be used as an identifier. 1.28 + Functioinal tests of the keyword may be found in the section corresponding 1.29 + to the function of the keyword. 1.30 + 1.31 + Author: christine@netscape.com 1.32 + Date: 12 november 1997 1.33 + 1.34 +*/ 1.35 +var SECTION = "lexical-030"; 1.36 +var VERSION = "JS1_4"; 1.37 +var TITLE = "Keywords"; 1.38 + 1.39 +startTest(); 1.40 +writeHeaderToLog( SECTION + " "+ TITLE); 1.41 + 1.42 +var result = "Failed"; 1.43 +var exception = "No exception thrown"; 1.44 +var expect = "Passed"; 1.45 + 1.46 +try { 1.47 + eval("var return = true;"); 1.48 +} catch ( e ) { 1.49 + result = expect; 1.50 + exception = e.toString(); 1.51 +} 1.52 + 1.53 +new TestCase( 1.54 + SECTION, 1.55 + "var return = true" + 1.56 + " (threw " + exception +")", 1.57 + expect, 1.58 + result ); 1.59 + 1.60 +test(); 1.61 + 1.62 +