|
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 * Empty string, 0, false are all equal (==) to each other, since they all evaluate to 0 |
|
6 * |
|
7 * @path ch08/8.4/S8.4_A8.js |
|
8 * @description Compare empty string with undefined, null, 0 and false |
|
9 */ |
|
10 |
|
11 var str=''; |
|
12 |
|
13 //////////////////////////////////////////////////////////// |
|
14 // CHECK#1 |
|
15 if (str == undefined){ |
|
16 $ERROR('#1: Empty string and undefined are not equal (!=) to each other'); |
|
17 } |
|
18 // |
|
19 ///////////////////////////////////////////////////////////// |
|
20 |
|
21 //////////////////////////////////////////////////////////// |
|
22 // CHECK#2 |
|
23 if (str == null){ |
|
24 $ERROR('#1: Empty string and Null are not equal (!=) to each other'); |
|
25 } |
|
26 // |
|
27 ///////////////////////////////////////////////////////////// |
|
28 |
|
29 //////////////////////////////////////////////////////////// |
|
30 // CHECK#3 |
|
31 if (str != 0){ |
|
32 $ERROR('#3: Empty string and 0 are equal (==) to each other, since they all evaluate to 0'); |
|
33 } |
|
34 // |
|
35 ///////////////////////////////////////////////////////////// |
|
36 |
|
37 //////////////////////////////////////////////////////////// |
|
38 // CHECK#4 |
|
39 if (str != false){ |
|
40 $ERROR('#4: Empty string and false are equal (==) to each other, since they all evaluate to 0'); |
|
41 } |
|
42 // |
|
43 ///////////////////////////////////////////////////////////// |
|
44 |