Wed, 31 Dec 2014 07:53:36 +0100
Correct small whitespace inconsistency, lost while renaming variables.
1 // Copyright 2009 the Sputnik authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
4 /**
5 * ToObject conversion from String: create a new String object
6 * whose [[value]] property is set to the value of the string
7 *
8 * @path ch09/9.9/S9.9_A5.js
9 * @description Converting from various strings to Object
10 */
12 // CHECK#1
13 if (Object("some string").valueOf() !== "some string"){
14 $ERROR('#1: Object("some string").valueOf() === "some string". Actual: ' + (Object("some string").valueOf()));
15 }
17 // CHECK#2
18 if (typeof Object("some string") !== "object"){
19 $ERROR('#2: typeof Object("some string") === "object". Actual: ' + (typeof Object("some string")));
20 }
22 // CHECK#3
23 if (Object("some string").constructor.prototype !== String.prototype){
24 $ERROR('#3: Object("some string").constructor.prototype === String.prototype. Actual: ' + (Object("some string").constructor.prototype));
25 }
27 // CHECK#4
28 if (Object("").valueOf() !== ""){
29 $ERROR('#4: Object("").valueOf() === false. Actual: ' + (Object("").valueOf()));
30 }
32 // CHECK#5
33 if (typeof Object("") !== "object"){
34 $ERROR('#5: typeof Object("") === "object". Actual: ' + (typeof Object("")));
35 }
37 // CHECK#6
38 if (Object("").constructor.prototype !== String.prototype){
39 $ERROR('#6: Object("").constructor.prototype === String.prototype. Actual: ' + (Object("").constructor.prototype));
40 }
42 // CHECK#7
43 if (Object("\r\t\b\n\v\f").valueOf() !== "\r\t\b\n\v\f"){
44 $ERROR('#7: Object("\\r\\t\\b\\n\\v\\f").valueOf() === false. Actual: ' + (Object("\r\t\b\n\v\f").valueOf()));
45 }
47 // CHECK#8
48 if (typeof Object("\r\t\b\n\v\f") !== "object"){
49 $ERROR('#8: typeof Object("\\r\\t\\b\\n\\v\\f") === "object". Actual: ' + (typeof Object("\r\t\b\n\v\f")));
50 }
52 // CHECK#9
53 if (Object("\r\t\b\n\v\f").constructor.prototype !== String.prototype){
54 $ERROR('#9: Object("\\r\\t\\b\\n\\v\\f").constructor.prototype === String.prototype. Actual: ' + (Object("\r\t\b\n\v\f").constructor.prototype));
55 }
57 // CHECK#10
58 if (Object(String(10)).valueOf() !== "10"){
59 $ERROR('#10: Object(String(10)).valueOf() === false. Actual: ' + (Object(String(10)).valueOf()));
60 }
62 // CHECK#11
63 if (typeof Object(String(10)) !== "object"){
64 $ERROR('#11: typeof Object(String(10)) === "object". Actual: ' + (typeof Object(String(10))));
65 }
67 // CHECK#12
68 if (Object(String(10)).constructor.prototype !== String.prototype){
69 $ERROR('#12: Object(String(10)).constructor.prototype === String.prototype. Actual: ' + (Object(String(10)).constructor.prototype));
70 }