| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
gTestfile = '15.5.2.js'; |
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
var SECTION = "15.5.2"; |
| 30 |
var VERSION = "ECMA_1"; |
| 31 |
startTest(); |
| 32 |
var TITLE = "The String Constructor"; |
| 33 |
|
| 34 |
writeHeaderToLog( SECTION + " "+ TITLE); |
| 35 |
|
| 36 |
|
| 37 |
new TestCase( SECTION, "typeof new String('string primitive')", "object", typeof new String('string primitive') ); |
| 38 |
new TestCase( SECTION, "var TESTSTRING = new String('string primitive'); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String('string primitive'); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") ); |
| 39 |
new TestCase( SECTION, "(new String('string primitive')).valueOf()", 'string primitive', (new String('string primitive')).valueOf() ); |
| 40 |
new TestCase( SECTION, "(new String('string primitive')).substring", String.prototype.substring, (new String('string primitive')).substring ); |
| 41 |
|
| 42 |
new TestCase( SECTION, "typeof new String(void 0)", "object", typeof new String(void 0) ); |
| 43 |
new TestCase( SECTION, "var TESTSTRING = new String(void 0); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(void 0); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") ); |
| 44 |
new TestCase( SECTION, "(new String(void 0)).valueOf()", "undefined", (new String(void 0)).valueOf() ); |
| 45 |
new TestCase( SECTION, "(new String(void 0)).toString", String.prototype.toString, (new String(void 0)).toString ); |
| 46 |
|
| 47 |
new TestCase( SECTION, "typeof new String(null)", "object", typeof new String(null) ); |
| 48 |
new TestCase( SECTION, "var TESTSTRING = new String(null); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(null); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") ); |
| 49 |
new TestCase( SECTION, "(new String(null)).valueOf()", "null", (new String(null)).valueOf() ); |
| 50 |
new TestCase( SECTION, "(new String(null)).valueOf", String.prototype.valueOf, (new String(null)).valueOf ); |
| 51 |
|
| 52 |
new TestCase( SECTION, "typeof new String(true)", "object", typeof new String(true) ); |
| 53 |
new TestCase( SECTION, "var TESTSTRING = new String(true); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(true); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") ); |
| 54 |
new TestCase( SECTION, "(new String(true)).valueOf()", "true", (new String(true)).valueOf() ); |
| 55 |
new TestCase( SECTION, "(new String(true)).charAt", String.prototype.charAt, (new String(true)).charAt ); |
| 56 |
|
| 57 |
new TestCase( SECTION, "typeof new String(false)", "object", typeof new String(false) ); |
| 58 |
new TestCase( SECTION, "var TESTSTRING = new String(false); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(false); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") ); |
| 59 |
new TestCase( SECTION, "(new String(false)).valueOf()", "false", (new String(false)).valueOf() ); |
| 60 |
new TestCase( SECTION, "(new String(false)).charCodeAt", String.prototype.charCodeAt, (new String(false)).charCodeAt ); |
| 61 |
|
| 62 |
new TestCase( SECTION, "typeof new String(new Boolean(true))", "object", typeof new String(new Boolean(true)) ); |
| 63 |
new TestCase( SECTION, "var TESTSTRING = new String(new Boolean(true)); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(new Boolean(true)); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") ); |
| 64 |
new TestCase( SECTION, "(new String(new Boolean(true))).valueOf()", "true", (new String(new Boolean(true))).valueOf() ); |
| 65 |
new TestCase( SECTION, "(new String(new Boolean(true))).indexOf", String.prototype.indexOf, (new String(new Boolean(true))).indexOf ); |
| 66 |
|
| 67 |
new TestCase( SECTION, "typeof new String()", "object", typeof new String() ); |
| 68 |
new TestCase( SECTION, "var TESTSTRING = new String(); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") ); |
| 69 |
new TestCase( SECTION, "(new String()).valueOf()", '', (new String()).valueOf() ); |
| 70 |
new TestCase( SECTION, "(new String()).lastIndexOf", String.prototype.lastIndexOf, (new String()).lastIndexOf ); |
| 71 |
|
| 72 |
new TestCase( SECTION, "typeof new String('')", "object", typeof new String('') ); |
| 73 |
new TestCase( SECTION, "var TESTSTRING = new String(''); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(''); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") ); |
| 74 |
new TestCase( SECTION, "(new String('')).valueOf()", '', (new String('')).valueOf() ); |
| 75 |
new TestCase( SECTION, "(new String('')).split", String.prototype.split, (new String('')).split ); |
| 76 |
|
| 77 |
test(); |