blob: 0f1e440ebf85780da9ea5b55acd0aa9f9c5db2ef [file] [log] [blame]
Test prototypes of various objects and the various means to access them.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS ('').__proto__ is String.prototype
PASS (0).__proto__ is Number.prototype
PASS ([]).__proto__ is Array.prototype
PASS ({}).__proto__ is Object.prototype
PASS (new Date).__proto__ is Date.prototype
PASS (new Number).__proto__ is Number.prototype
PASS (new Object).__proto__ is Object.prototype
PASS (new String).__proto__ is String.prototype
PASS Array.prototype.__proto__ is Object.prototype
PASS Date.prototype.__proto__ is Object.prototype
PASS Number.prototype.__proto__ is Object.prototype
PASS Object.prototype.__proto__ is null
PASS String.prototype.__proto__ is Object.prototype
PASS Array.__proto__ is Object.__proto__
PASS Date.__proto__ is Object.__proto__
PASS Number.__proto__ is Object.__proto__
PASS String.__proto__ is Object.__proto__
PASS Object.getPrototypeOf('') threw exception TypeError: Requested prototype of a value that is not an object..
PASS Object.getPrototypeOf(0) threw exception TypeError: Requested prototype of a value that is not an object..
PASS Object.getPrototypeOf([]) is Array.prototype
PASS Object.getPrototypeOf({}) is Object.prototype
PASS Object.getPrototypeOf(new Date) is Date.prototype
PASS Object.getPrototypeOf(new Number) is Number.prototype
PASS Object.getPrototypeOf(new Object) is Object.prototype
PASS Object.getPrototypeOf(new String) is String.prototype
PASS Object.getPrototypeOf(Array.prototype) is Object.prototype
PASS Object.getPrototypeOf(Date.prototype) is Object.prototype
PASS Object.getPrototypeOf(Number.prototype) is Object.prototype
PASS Object.getPrototypeOf(Object.prototype) is null
PASS Object.getPrototypeOf(String.prototype) is Object.prototype
PASS Object.getPrototypeOf(Array) is Object.__proto__
PASS Object.getPrototypeOf(Date) is Object.__proto__
PASS Object.getPrototypeOf(Number) is Object.__proto__
PASS Object.getPrototypeOf(String) is Object.__proto__
PASS String.prototype.isPrototypeOf('') is false
PASS Number.prototype.isPrototypeOf(0) is false
PASS Array.prototype.isPrototypeOf([]) is true
PASS Object.prototype.isPrototypeOf({}) is true
PASS Date.prototype.isPrototypeOf(new Date) is true
PASS Number.prototype.isPrototypeOf(new Number) is true
PASS Object.prototype.isPrototypeOf(new Object) is true
PASS String.prototype.isPrototypeOf(new String) is true
PASS Object.prototype.isPrototypeOf(Array.prototype) is true
PASS Object.prototype.isPrototypeOf(Date.prototype) is true
PASS Object.prototype.isPrototypeOf(Number.prototype) is true
PASS Object.prototype.isPrototypeOf(String.prototype) is true
PASS Object.__proto__.isPrototypeOf(Array) is true
PASS Object.__proto__.isPrototypeOf(Date) is true
PASS Object.__proto__.isPrototypeOf(Number) is true
PASS Object.__proto__.isPrototypeOf(String) is true
PASS var wasSet = false; var o = { }; o.__defineGetter__("__proto__", function() { wasSet = true }); o.__proto__; wasSet; is true
PASS var wasSet = false; var o = { }; o.__defineSetter__("__proto__", function() { wasSet = true }); o.__proto__ = {}; wasSet; is true
PASS var wasSet = false; var o = { }; Object.defineProperty(o, "__proto__", { "get": function() { wasSet = true } }); o.__proto__; wasSet; is true
PASS var wasSet = false; var o = { }; Object.defineProperty(o, "__proto__", { "__proto__": function(x) { wasSet = true } }); o.__proto__ = {}; wasSet; is false
PASS var o = {}; o.__proto__ = { x:true }; o.x is true
PASS var o = {}; o.__proto__ = { x:true }; o.hasOwnProperty('__proto__') is false
PASS var o = {}; o.__proto__ = { x:true }; o.x is undefined.
PASS var o = {}; o.__proto__ = { x:true }; o.hasOwnProperty('__proto__') is true
PASS successfullyParsed is true
TEST COMPLETE