|
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 * Any variable that has been assigned with string literal has the type string |
|
6 * |
|
7 * @path ch08/8.4/S8.4_A1.js |
|
8 * @description Check type of variable that has been assigned with string literal |
|
9 */ |
|
10 |
|
11 ///////////////////////////////////////////////////////// |
|
12 // CHECK#1 |
|
13 var str="abcdfg"; |
|
14 if (typeof(str)!=="string"){ |
|
15 $ERROR('#1: var str="abcdfg"; typeof(str) === "string". Actual: ' + (typeof(str))); |
|
16 } |
|
17 // |
|
18 //////////////////////////////////////////////////////// |
|
19 |
|
20 ///////////////////////////////////////////////////////// |
|
21 // CHECK#2 |
|
22 var str2='qwerty'; |
|
23 if (typeof(str2)!=="string"){ |
|
24 $ERROR('#2: var str2=\'qwerty\'; typeof(str) === "string". Actual: ' + (typeof(str2))); |
|
25 } |
|
26 // |
|
27 //////////////////////////////////////////////////////// |
|
28 |
|
29 ///////////////////////////////////////////////////////// |
|
30 // CHECK#3 |
|
31 var __str='\u0042\u0043\u0044\u0045\u0046\u0047\u0048'; |
|
32 if (typeof(__str)!=="string"){ |
|
33 $ERROR('#3: var __str=\'\\u0042\\u0043\\u0044\\u0045\\u0046\\u0047\\u0048\'; typeof(__str) === "string". Actual: ' + (typeof(__str))); |
|
34 } |
|
35 // |
|
36 //////////////////////////////////////////////////////// |
|
37 |
|
38 ///////////////////////////////////////////////////////// |
|
39 // CHECK#4 |
|
40 var str__="\u0042\u0043\u0044\u0045\u0046\u0047\u0048"; |
|
41 if (typeof(str__)!=="string"){ |
|
42 $ERROR('#4: var str__="abcdfg"; typeof(str__) === "string". Actual: ' + (typeof(str__))); |
|
43 } |
|
44 // |
|
45 //////////////////////////////////////////////////////// |
|
46 |