| 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 = 'if-001.js'; |
| 7 | |
| 8 | /** |
| 9 | * File Name: if-001.js |
| 10 | * ECMA Section: |
| 11 | * Description: The if statement |
| 12 | * |
| 13 | * Verify that assignment in the if expression is evaluated correctly. |
| 14 | * Verifies the fix for bug http://scopus/bugsplat/show_bug.cgi?id=148822. |
| 15 | * |
| 16 | * Author: [email protected] |
| 17 | * Date: 28 August 1998 |
| 18 | */ |
| 19 | var SECTION = "for-001"; |
| 20 | var VERSION = "ECMA_2"; |
| 21 | var TITLE = "The if statement"; |
| 22 | var BUGNUMBER="148822"; |
| 23 | |
| 24 | startTest(); |
| 25 | writeHeaderToLog( SECTION + " "+ TITLE); |
| 26 | |
| 27 | var a = 0; |
| 28 | var b = 0; |
| 29 | var result = "passed"; |
| 30 | |
| 31 | if ( a = b ) { |
| 32 | result = "failed: a = b should return 0"; |
| 33 | } |
| 34 | |
| 35 | new TestCase( |
| 36 | SECTION, |
| 37 | "if ( a = b ), where a and b are both equal to 0", |
| 38 | "passed", |
| 39 | result ); |
| 40 | |
| 41 | |
| 42 | test(); |
| 43 |