Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/addition/S11.6.1_A3.2_T2.4.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 If Type(Primitive(x)) is String or Type(Primitive(y)) is String, then
7 operator x + y returns the result of concatenating ToString(x) followed
8 by ToString(y)
9 es5id: 11.6.1_A3.2_T2.4
10 description: >
11 Type(Primitive(x)) is different from Type(Primitive(y)) and both
12 types vary between String (primitive or object) and Null
13 ---*/
14
15 //CHECK#1
16 if ("1" + null !== "1null") {
17 $ERROR('#1: "1" + null === "1null". Actual: ' + ("1" + null));
18 }
19
20 //CHECK#2
21 if (null + "1" !== "null1") {
22 $ERROR('#2: null + "1" === "null1". Actual: ' + (null + "1"));
23 }
24
25 //CHECK#3
26 if (new String("1") + null !== "1null") {
27 $ERROR('#3: new String("1") + null === "1null". Actual: ' + (new String("1") + null));
28 }
29
30 //CHECK#4
31 if (null + new String("1") !== "null1") {
32 $ERROR('#4: null + new String("1") === "null1". Actual: ' + (null + new String("1")));
33 }