|
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 * 1, true, non-empty string and others in expression is evaluated to true when using operator "new" |
|
6 * |
|
7 * @path ch12/12.5/S12.5_A1.2_T1.js |
|
8 * @description Using "if" without "else" construction |
|
9 */ |
|
10 |
|
11 ////////////////////////////////////////////////////////////////////////////// |
|
12 //CHECK#1 |
|
13 if(!(new Number(1))) |
|
14 $ERROR('#1: new 1 in expression is evaluated to true'); |
|
15 // |
|
16 ////////////////////////////////////////////////////////////////////////////// |
|
17 |
|
18 ////////////////////////////////////////////////////////////////////////////// |
|
19 //CHECK#2 |
|
20 if(!(new Boolean(true))) |
|
21 $ERROR('#2: new true in expression is evaluated to true'); |
|
22 // |
|
23 ////////////////////////////////////////////////////////////////////////////// |
|
24 |
|
25 ////////////////////////////////////////////////////////////////////////////// |
|
26 //CHECK#3 |
|
27 if(!(new String("1"))) |
|
28 $ERROR('#3: new "1" in expression is evaluated to true'); |
|
29 // |
|
30 ////////////////////////////////////////////////////////////////////////////// |
|
31 |
|
32 ////////////////////////////////////////////////////////////////////////////// |
|
33 //CHECK#4 |
|
34 if(!(new String("A"))) |
|
35 $ERROR('#4: new "A" in expression is evaluated to true'); |
|
36 // |
|
37 ////////////////////////////////////////////////////////////////////////////// |
|
38 |
|
39 ////////////////////////////////////////////////////////////////////////////// |
|
40 //CHECK#5 |
|
41 if(!(new Boolean(false))) |
|
42 $ERROR('#2: new false in expression is evaluated to true '); |
|
43 // |
|
44 ////////////////////////////////////////////////////////////////////////////// |
|
45 |
|
46 ////////////////////////////////////////////////////////////////////////////// |
|
47 //CHECK#6 |
|
48 if(!(new Number(NaN))) |
|
49 $ERROR('#6: new NaN in expression is evaluated to true '); |
|
50 // |
|
51 ////////////////////////////////////////////////////////////////////////////// |
|
52 |
|
53 ////////////////////////////////////////////////////////////////////////////// |
|
54 //CHECK#7 |
|
55 if(!(new Number(null))) |
|
56 $ERROR('#7: new null in expression is evaluated to true '); |
|
57 // |
|
58 ////////////////////////////////////////////////////////////////////////////// |
|
59 |
|
60 ////////////////////////////////////////////////////////////////////////////// |
|
61 //CHECK#8 |
|
62 if(!(new String(undefined))) |
|
63 $ERROR('#8: new undefined in expression is evaluated to true '); |
|
64 // |
|
65 ////////////////////////////////////////////////////////////////////////////// |
|
66 |
|
67 ////////////////////////////////////////////////////////////////////////////// |
|
68 //CHECK#9 |
|
69 if(!(new String(""))) |
|
70 $ERROR('#9: new empty string in expression is evaluated to true '); |
|
71 // |
|
72 ////////////////////////////////////////////////////////////////////////////// |
|
73 |