blob: cc91515f1c637363e03b2277e72b8004e712b101 [file] [log] [blame]
keith_miller@apple.combcc77f22016-07-15 06:03:25 +00001// Copyright 2009 the Sputnik authors. All rights reserved.
2// This code is governed by the BSD license found in the LICENSE file.
3
4/*---
5info: The production x ^= y is the same as x = x ^ y
6es5id: 11.13.2_A4.10_T2.2
7description: >
8 Type(x) is different from Type(y) and both types vary between
9 Number (primitive or object) and String (primitive and object)
10---*/
11
12var x;
13
14//CHECK#1
15x = "1";
16x ^= 1;
17if (x !== 0) {
18 $ERROR('#1: x = "1"; x ^= 1; x === 0. Actual: ' + (x));
19}
20
21//CHECK#2
22x = 1;
23x ^= "1";
24if (x !== 0) {
25 $ERROR('#2: x = 1; x ^= "1"; x === 0. Actual: ' + (x));
26}
27
28//CHECK#3
29x = new String("1");
30x ^= 1;
31if (x !== 0) {
32 $ERROR('#3: x = new String("1"); x ^= 1; x === 0. Actual: ' + (x));
33}
34
35//CHECK#4
36x = 1;
37x ^= new String("1");
38if (x !== 0) {
39 $ERROR('#4: x = 1; x ^= new String("1"); x === 0. Actual: ' + (x));
40}
41
42//CHECK#5
43x = "1";
44x ^= new Number(1);
45if (x !== 0) {
46 $ERROR('#5: x = "1"; x ^= new Number(1); x === 0. Actual: ' + (x));
47}
48
49//CHECK#6
50x = new Number(1);
51x ^= "1";
52if (x !== 0) {
53 $ERROR('#6: x = new Number(1); x ^= "1"; x === 0. Actual: ' + (x));
54}
55
56//CHECK#7
57x = new String("1");
58x ^= new Number(1);
59if (x !== 0) {
60 $ERROR('#7: x = new String("1"); x ^= new Number(1); x === 0. Actual: ' + (x));
61}
62
63//CHECK#8
64x = new Number(1);
65x ^= new String("1");
66if (x !== 0) {
67 $ERROR('#8: x = new Number(1); x ^= new String("1"); x === 0. Actual: ' + (x));
68}
69
70//CHECK#9
71x = "x";
72x ^= 1;
73if (x !== 1) {
74 $ERROR('#9: x = "x"; x ^= 1; x === 1. Actual: ' + (x));
75}
76
77//CHECK#10
78x = 1;
79x ^= "x";
80if (x !== 1) {
81 $ERROR('#10: x = 1; x ^= "x"; x === 1. Actual: ' + (x));
82}