Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(480)

Side by Side Diff: test/webkit/prototypes.js

Issue 18068003: Migrated several tests from blink to V8 repository. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/webkit/propertyIsEnumerable-expected.txt ('k') | test/webkit/prototypes-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3 //
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions
6 // are met:
7 // 1. Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer.
9 // 2. Redistributions in binary form must reproduce the above copyright
10 // notice, this list of conditions and the following disclaimer in the
11 // documentation and/or other materials provided with the distribution.
12 //
13 // THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND AN Y
14 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16 // DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR AN Y
17 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND O N
20 // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23
24 description(
25 'Test prototypes of various objects and the various means to access them.'
26 );
27
28 shouldBe("('').__proto__", "String.prototype");
29 shouldBe("(0).__proto__", "Number.prototype");
30 shouldBe("([]).__proto__", "Array.prototype");
31 shouldBe("({}).__proto__", "Object.prototype");
32 shouldBe("(new Date).__proto__", "Date.prototype");
33 shouldBe("(new Number).__proto__", "Number.prototype");
34 shouldBe("(new Object).__proto__", "Object.prototype");
35 shouldBe("(new String).__proto__", "String.prototype");
36 shouldBe("Array.prototype.__proto__", "Object.prototype");
37 shouldBe("Date.prototype.__proto__", "Object.prototype");
38 shouldBe("Number.prototype.__proto__", "Object.prototype");
39 shouldBe("Object.prototype.__proto__", "null");
40 shouldBe("String.prototype.__proto__", "Object.prototype");
41 shouldBe("Array.__proto__", "Object.__proto__");
42 shouldBe("Date.__proto__", "Object.__proto__");
43 shouldBe("Number.__proto__", "Object.__proto__");
44 shouldBe("String.__proto__", "Object.__proto__");
45
46 shouldThrow("Object.getPrototypeOf('')");
47 shouldThrow("Object.getPrototypeOf(0)");
48 shouldBe("Object.getPrototypeOf([])", "Array.prototype");
49 shouldBe("Object.getPrototypeOf({})", "Object.prototype");
50 shouldBe("Object.getPrototypeOf(new Date)", "Date.prototype");
51 shouldBe("Object.getPrototypeOf(new Number)", "Number.prototype");
52 shouldBe("Object.getPrototypeOf(new Object)", "Object.prototype");
53 shouldBe("Object.getPrototypeOf(new String)", "String.prototype");
54 shouldBe("Object.getPrototypeOf(Array.prototype)", "Object.prototype");
55 shouldBe("Object.getPrototypeOf(Date.prototype)", "Object.prototype");
56 shouldBe("Object.getPrototypeOf(Number.prototype)", "Object.prototype");
57 shouldBe("Object.getPrototypeOf(Object.prototype)", "null");
58 shouldBe("Object.getPrototypeOf(String.prototype)", "Object.prototype");
59 shouldBe("Object.getPrototypeOf(Array)", "Object.__proto__");
60 shouldBe("Object.getPrototypeOf(Date)", "Object.__proto__");
61 shouldBe("Object.getPrototypeOf(Number)", "Object.__proto__");
62 shouldBe("Object.getPrototypeOf(String)", "Object.__proto__");
63
64 shouldBeFalse("String.prototype.isPrototypeOf('')");
65 shouldBeFalse("Number.prototype.isPrototypeOf(0)");
66 shouldBeTrue("Array.prototype.isPrototypeOf([])");
67 shouldBeTrue("Object.prototype.isPrototypeOf({})");
68 shouldBeTrue("Date.prototype.isPrototypeOf(new Date)");
69 shouldBeTrue("Number.prototype.isPrototypeOf(new Number)");
70 shouldBeTrue("Object.prototype.isPrototypeOf(new Object)");
71 shouldBeTrue("String.prototype.isPrototypeOf(new String)");
72 shouldBeTrue("Object.prototype.isPrototypeOf(Array.prototype)");
73 shouldBeTrue("Object.prototype.isPrototypeOf(Date.prototype)");
74 shouldBeTrue("Object.prototype.isPrototypeOf(Number.prototype)");
75 shouldBeTrue("Object.prototype.isPrototypeOf(String.prototype)");
76 shouldBeTrue("Object.__proto__.isPrototypeOf(Array)");
77 shouldBeTrue("Object.__proto__.isPrototypeOf(Date)");
78 shouldBeTrue("Object.__proto__.isPrototypeOf(Number)");
79 shouldBeTrue("Object.__proto__.isPrototypeOf(String)");
80
81 shouldBeTrue("var wasSet = false; var o = { }; o.__defineGetter__(\"__proto__\", function() { wasSet = true }); o.__proto__; wasSet;");
82 shouldBeTrue("var wasSet = false; var o = { }; o.__defineSetter__(\"__proto__\", function() { wasSet = true }); o.__proto__ = {}; wasSet;");
83 shouldBeTrue("var wasSet = false; var o = { }; Object.defineProperty(o, \"__prot o__\", { \"get\": function() { wasSet = true } }); o.__proto__; wasSet;");
84 shouldBeFalse("var wasSet = false; var o = { }; Object.defineProperty(o, \"__pro to__\", { \"__proto__\": function(x) { wasSet = true } }); o.__proto__ = {}; was Set;");
85
86 // Deleting Object.prototype.__proto__ removes the ability to set the object's p rototype.
87 shouldBeTrue("var o = {}; o.__proto__ = { x:true }; o.x");
88 shouldBeFalse("var o = {}; o.__proto__ = { x:true }; o.hasOwnProperty('__proto__ ')");
89 delete Object.prototype.__proto__;
90 shouldBeUndefined("var o = {}; o.__proto__ = { x:true }; o.x");
91 shouldBeTrue("var o = {}; o.__proto__ = { x:true }; o.hasOwnProperty('__proto__' )");
OLDNEW
« no previous file with comments | « test/webkit/propertyIsEnumerable-expected.txt ('k') | test/webkit/prototypes-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698