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