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

Side by Side Diff: test/webkit/fast/js/kde/object_prototype.js

Issue 21173004: Version 3.20.11.1 (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 7 years, 4 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
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("KDE JS Test");
25 // Object.prototype.hasOwnProperty
26
27 function MyClass()
28 {
29 this.y = 2;
30 }
31
32 MyClass.prototype = { x : 1 };
33
34 var sub = new MyClass();
35 shouldBe("sub.x","1");
36 shouldBe("sub.y","2");
37 shouldBe("sub.hasOwnProperty('x')","false");
38 shouldBe("sub.hasOwnProperty('y')","true");
39 sub.x = 6;
40 shouldBe("sub.x","6");
41 shouldBe("sub.hasOwnProperty('x')","true");
42 delete sub.y;
43 shouldBe("sub.y","undefined");
44 shouldBe("sub.hasOwnProperty('y')","false");
45
46
47
48 // Object.prototype.isPrototypeOf
49
50 function Class1() {}
51 function Class2() {}
52 function Class3() {}
53
54 Class1.prototype = new Object();
55 Class1.prototype.hasClass1 = true;
56 Class2.prototype = new Class1();
57 Class2.prototype.hasClass2 = true;
58 Class3.prototype = new Class2();
59 Class3.prototype.hasClass3 = true;
60
61 var obj = new Class3();
62 shouldBe("obj.hasClass1","true");
63 shouldBe("obj.hasClass2","true");
64 shouldBe("obj.hasClass3","true");
65
66 shouldBe("Class1.prototype.isPrototypeOf(obj)","true");
67 shouldBe("Class2.prototype.isPrototypeOf(obj)","true");
68 shouldBe("Class3.prototype.isPrototypeOf(obj)","true");
69 shouldBe("obj.isPrototypeOf(Class1.prototype)","false");
70 shouldBe("obj.isPrototypeOf(Class2.prototype)","false");
71 shouldBe("obj.isPrototypeOf(Class3.prototype)","false");
72
73 shouldBe("Class1.prototype.isPrototypeOf(Class2.prototype)","true");
74 shouldBe("Class2.prototype.isPrototypeOf(Class1.prototype)","false");
75 shouldBe("Class1.prototype.isPrototypeOf(Class3.prototype)","true");
76 shouldBe("Class3.prototype.isPrototypeOf(Class1.prototype)","false");
77 shouldBe("Class2.prototype.isPrototypeOf(Class3.prototype)","true");
78 shouldBe("Class3.prototype.isPrototypeOf(Class2.prototype)","false");
79
80 shouldBeUndefined("Class1.prototype.prototype");
81
82 function checkEnumerable(obj,property)
83 {
84 for (var propname in obj) {
85 if (propname == property)
86 return true;
87 }
88 return false;
89 }
90
91 function myfunc(a,b,c)
92 {
93 }
94 myfunc.someproperty = 4;
95
96 shouldBe("myfunc.length","3");
97 shouldBe("myfunc.someproperty","4");
98 shouldBe("myfunc.propertyIsEnumerable('length')","false");
99 shouldBe("myfunc.propertyIsEnumerable('someproperty')","true");
100 shouldBe("checkEnumerable(myfunc,'length')","false");
101 shouldBe("checkEnumerable(myfunc,'someproperty')","true");
OLDNEW
« no previous file with comments | « test/webkit/fast/js/kde/md5-2-expected.txt ('k') | test/webkit/fast/js/kde/object_prototype-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698