|
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 * The production x |= y is the same as x = x | y |
|
6 * |
|
7 * @path ch11/11.13/11.13.2/S11.13.2_A4.11_T2.2.js |
|
8 * @description Type(x) is different from Type(y) and both types vary between Number (primitive or object) and String (primitive and object) |
|
9 */ |
|
10 |
|
11 //CHECK#1 |
|
12 x = "1"; |
|
13 x |= 1; |
|
14 if (x !== 1) { |
|
15 $ERROR('#1: x = "1"; x |= 1; x === 1. Actual: ' + (x)); |
|
16 } |
|
17 |
|
18 //CHECK#2 |
|
19 x = 1; |
|
20 x |= "1"; |
|
21 if (x !== 1) { |
|
22 $ERROR('#2: x = 1; x |= "1"; x === 1. Actual: ' + (x)); |
|
23 } |
|
24 |
|
25 //CHECK#3 |
|
26 x = new String("1"); |
|
27 x |= 1; |
|
28 if (x !== 1) { |
|
29 $ERROR('#3: x = new String("1"); x |= 1; x === 1. Actual: ' + (x)); |
|
30 } |
|
31 |
|
32 //CHECK#4 |
|
33 x = 1; |
|
34 x |= new String("1"); |
|
35 if (x !== 1) { |
|
36 $ERROR('#4: x = 1; x |= new String("1"); x === 1. Actual: ' + (x)); |
|
37 } |
|
38 |
|
39 //CHECK#5 |
|
40 x = "1"; |
|
41 x |= new Number(1); |
|
42 if (x !== 1) { |
|
43 $ERROR('#5: x = "1"; x |= new Number(1); x === 1. Actual: ' + (x)); |
|
44 } |
|
45 |
|
46 //CHECK#6 |
|
47 x = new Number(1); |
|
48 x |= "1"; |
|
49 if (x !== 1) { |
|
50 $ERROR('#6: x = new Number(1); x |= "1"; x === 1. Actual: ' + (x)); |
|
51 } |
|
52 |
|
53 //CHECK#7 |
|
54 x = new String("1"); |
|
55 x |= new Number(1); |
|
56 if (x !== 1) { |
|
57 $ERROR('#7: x = new String("1"); x |= new Number(1); x === 1. Actual: ' + (x)); |
|
58 } |
|
59 |
|
60 //CHECK#8 |
|
61 x = new Number(1); |
|
62 x |= new String("1"); |
|
63 if (x !== 1) { |
|
64 $ERROR('#8: x = new Number(1); x |= new String("1"); x === 1. Actual: ' + (x)); |
|
65 } |
|
66 |
|
67 //CHECK#9 |
|
68 x = "x"; |
|
69 x |= 1; |
|
70 if (x !== 1) { |
|
71 $ERROR('#9: x = "x"; x |= 1; x === 1. Actual: ' + (x)); |
|
72 } |
|
73 |
|
74 //CHECK#10 |
|
75 x = 1; |
|
76 x |= "x"; |
|
77 if (x !== 1) { |
|
78 $ERROR('#10: x = 1; x |= "x"; x === 1. Actual: ' + (x)); |
|
79 } |
|
80 |