Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/addition/S11.6.1_A3.2_T1.1.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_T1.1
10 description: >
11 Type(Primitive(x)) and Type(Primitive(y)) vary between primitive
12 string and String object
13 ---*/
14
15 //CHECK#1
16 if ("1" + "1" !== "11") {
17 $ERROR('#1: "1" + "1" === "11". Actual: ' + ("1" + "1"));
18 }
19
20 //CHECK#2
21 if (new String("1") + "1" !== "11") {
22 $ERROR('#2: new String("1") + "1" === "11". Actual: ' + (new String("1") + "1"));
23 }
24
25 //CHECK#3
26 if ("1" + new String("1") !== "11") {
27 $ERROR('#3: "1" + new String("1") === "11". Actual: ' + ("1" + new String("1")));
28 }
29
30 //CHECK#4
31 if (new String("1") + new String("1") !== "11") {
32 $ERROR('#4: new String("1") + new String("1") === "11". Actual: ' + (new String("1") + new String("1")));
33 }
34
35 //CHECK#5
36 if ("x" + "1" !=="x1") {
37 $ERROR('#5: "x" + "1" === "x1". Actual: ' + ("x" + "1"));
38 }
39
40 //CHECK#6
41 if ("1" + "x" !== "1x") {
42 $ERROR('#6: "1" + "x" === "1x". Actual: ' + ("1" + "x"));
43 }