Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/logical-and/S11.11.1_A4_T3.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: If ToBoolean(x) is true, return y
6 es5id: 11.11.1_A4_T3
7 description: Type(x) and Type(y) vary between primitive string and String object
8 ---*/
9
10 //CHECK#1
11 if (("0" && "-1") !== "-1") {
12 $ERROR('#-1: ("0" && "-1") === "-1"');
13 }
14
15 //CHECK#2
16 if (("-1" && "x") !== "x") {
17 $ERROR('#2: ("-1" && "x") === "x"');
18 }
19
20 //CHECK#3
21 var y = new String(-1);
22 if ((new String("-1") && y) !== y) {
23 $ERROR('#3: (var y = new String(-1); (new String("-1") && y) === y');
24 }
25
26 //CHECK#4
27 var y = new String(NaN);
28 if ((new String("0") && y) !== y) {
29 $ERROR('#4: (var y = new String(NaN); (new String("0") && y) === y');
30 }
31
32 //CHECK#5
33 var y = new String("-x");
34 if ((new String("x") && y) !== y) {
35 $ERROR('#5: (var y = new String("-x"); (new String("x") && y) === y');
36 }
37
38 //CHECK#6
39 var y = new String(-1);
40 if ((new String(NaN) && y) !== y) {
41 $ERROR('#6: (var y = new String(-1); (new String(NaN) && y) === y');
42 }