Debian Codegraph @

js/src/tests/test262/language/statements/if/S12.5_A1.1_T1.js

raw
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 0, null, undefined, false, empty string, NaN in expression is evaluated
7 to false
8 es5id: 12.5_A1.1_T1
9 description: Using "if" without "else" construction
10 ---*/
11
12 //////////////////////////////////////////////////////////////////////////////
13 //CHECK#1
14
15 if(0)
16 throw new Test262Error('#1: 0 in expression is evaluated to false ');
17 //
18 //////////////////////////////////////////////////////////////////////////////
19
20 //////////////////////////////////////////////////////////////////////////////
21 //CHECK#2
22 if(false)
23 throw new Test262Error('#2: false in expression is evaluated to false ');
24 //
25 //////////////////////////////////////////////////////////////////////////////
26
27 //////////////////////////////////////////////////////////////////////////////
28 //CHECK#3
29 if(null)
30 throw new Test262Error('#3: null in expression is evaluated to false ');
31 //
32 //////////////////////////////////////////////////////////////////////////////
33
34 //////////////////////////////////////////////////////////////////////////////
35 //CHECK#4
36 if(undefined)
37 throw new Test262Error('#4: undefined in expression is evaluated to false ');
38 //
39 //////////////////////////////////////////////////////////////////////////////
40
41 //////////////////////////////////////////////////////////////////////////////
42 //CHECK#5
43 if("")
44 throw new Test262Error('#5: empty string in expression is evaluated to false ');
45 //
46 //////////////////////////////////////////////////////////////////////////////
47
48 //////////////////////////////////////////////////////////////////////////////
49 //CHECK#6
50 if(NaN)
51 throw new Test262Error('#5: NaN in expression is evaluated to false ');
52 //
53 //////////////////////////////////////////////////////////////////////////////
54
55 reportCompare(0, 0);