| 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 = 'while-001.js'; |
| 7 | |
| 8 | /** |
| 9 | * File Name: while-001 |
| 10 | * ECMA Section: |
| 11 | * Description: while statement |
| 12 | * |
| 13 | * Verify that the while statement is not executed if the while expression is |
| 14 | * false |
| 15 | * |
| 16 | * Author: [email protected] |
| 17 | * Date: 11 August 1998 |
| 18 | */ |
| 19 | var SECTION = "while-001"; |
| 20 | var VERSION = "ECMA_2"; |
| 21 | var TITLE = "while statement"; |
| 22 | |
| 23 | startTest(); |
| 24 | writeHeaderToLog( SECTION + " "+ TITLE); |
| 25 | |
| 26 | DoWhile(); |
| 27 | test(); |
| 28 | |
| 29 | function DoWhile() { |
| 30 | result = "pass"; |
| 31 | |
| 32 | while (false) { |
| 33 | result = "fail"; |
| 34 | break; |
| 35 | } |
| 36 | |
| 37 | new TestCase( |
| 38 | SECTION, |
| 39 | "while statement: don't evaluate statement is expression is false", |
| 40 | "pass", |
| 41 | result ); |
| 42 | |
| 43 | } |