| 1 |
// Copyright 2009 the Sputnik authors. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
|
| 4 |
/*--- |
| 5 |
info: | |
| 6 |
Expression from "while" IterationStatement is evaluated first; "false", |
| 7 |
"0", "null", "undefined" and "empty" strings used as the Expression are |
| 8 |
evaluated to "false" |
| 9 |
es5id: 12.6.2_A1 |
| 10 |
description: Evaluating various Expressions |
| 11 |
---*/ |
| 12 |
|
| 13 |
var __in__do; |
| 14 |
|
| 15 |
while ( false ) __in__do=1; |
| 16 |
|
| 17 |
////////////////////////////////////////////////////////////////////////////// |
| 18 |
//CHECK#1 |
| 19 |
if (__in__do !== undefined) { |
| 20 |
throw new Test262Error('#1: false evaluates to false'); |
| 21 |
} |
| 22 |
// |
| 23 |
////////////////////////////////////////////////////////////////////////////// |
| 24 |
|
| 25 |
while ( 0 ) __in__do=2; |
| 26 |
|
| 27 |
////////////////////////////////////////////////////////////////////////////// |
| 28 |
//CHECK#2 |
| 29 |
if (__in__do !== undefined) { |
| 30 |
throw new Test262Error('#2: 0 evaluates to false'); |
| 31 |
} |
| 32 |
// |
| 33 |
////////////////////////////////////////////////////////////////////////////// |
| 34 |
|
| 35 |
while ( "" ) __in__do=3; |
| 36 |
|
| 37 |
////////////////////////////////////////////////////////////////////////////// |
| 38 |
//CHECK#3 |
| 39 |
if (__in__do !== undefined) { |
| 40 |
throw new Test262Error('#3: empty string evaluates to false'); |
| 41 |
} |
| 42 |
// |
| 43 |
////////////////////////////////////////////////////////////////////////////// |
| 44 |
|
| 45 |
while ( null ) __in__do=4; |
| 46 |
|
| 47 |
////////////////////////////////////////////////////////////////////////////// |
| 48 |
//CHECK#4 |
| 49 |
if (__in__do !== undefined) { |
| 50 |
throw new Test262Error('#4: null evaluates to false'); |
| 51 |
} |
| 52 |
// |
| 53 |
////////////////////////////////////////////////////////////////////////////// |
| 54 |
|
| 55 |
while ( undefined ) __in__do=35; |
| 56 |
|
| 57 |
////////////////////////////////////////////////////////////////////////////// |
| 58 |
//CHECK#5 |
| 59 |
if (__in__do !== undefined) { |
| 60 |
throw new Test262Error('#5: undefined evaluates to false'); |
| 61 |
} |
| 62 |
// |
| 63 |
////////////////////////////////////////////////////////////////////////////// |
| 64 |
|
| 65 |
reportCompare(0, 0); |