# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1.  Redistributions of source code must retain the above copyright
#     notice, this list of conditions and the following disclaimer.
# 2.  Redistributions in binary form must reproduce the above copyright
#     notice, this list of conditions and the following disclaimer in the
#     documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

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: Object.getPrototypeOf called on non-object.
PASS Object.getPrototypeOf(0) threw exception TypeError: Object.getPrototypeOf called on non-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

