| 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
| 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
| 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 5 | |
| 6 | gTestfile = 'lexical-028.js'; |
| 7 | |
| 8 | /** |
| 9 | File Name: lexical-028.js |
| 10 | Corresponds To: 7.4.2-5-n.js |
| 11 | ECMA Section: 7.4.2 |
| 12 | |
| 13 | Description: |
| 14 | The following tokens are ECMAScript keywords and may not be used as |
| 15 | identifiers in ECMAScript programs. |
| 16 | |
| 17 | Syntax |
| 18 | |
| 19 | Keyword :: one of |
| 20 | break for new var |
| 21 | continue function return void |
| 22 | delete if this while |
| 23 | else in typeof with |
| 24 | |
| 25 | This test verifies that the keyword cannot be used as an identifier. |
| 26 | Functioinal tests of the keyword may be found in the section corresponding |
| 27 | to the function of the keyword. |
| 28 | |
| 29 | Author: [email protected] |
| 30 | Date: 12 november 1997 |
| 31 | |
| 32 | */ |
| 33 | var SECTION = "lexical-028"; |
| 34 | var VERSION = "JS1_4"; |
| 35 | var TITLE = "Keywords"; |
| 36 | |
| 37 | startTest(); |
| 38 | writeHeaderToLog( SECTION + " "+ TITLE); |
| 39 | |
| 40 | var result = "Failed"; |
| 41 | var exception = "No exception thrown"; |
| 42 | var expect = "Passed"; |
| 43 | |
| 44 | try { |
| 45 | eval("var continue=true;"); |
| 46 | } catch ( e ) { |
| 47 | result = expect; |
| 48 | exception = e.toString(); |
| 49 | } |
| 50 | |
| 51 | new TestCase( |
| 52 | SECTION, |
| 53 | "var continue=true" + |
| 54 | " (threw " + exception +")", |
| 55 | expect, |
| 56 | result ); |
| 57 | |
| 58 | test(); |
| 59 | |
| 60 |