Update with current status
[gnash.git] / testsuite / as3compile.all / Object.as
blob08740adbd6ef9ac03c557a4178b06372c712810d
1 //
2 // Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software
3 // Foundation, Inc
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 #include "check.as"
21 // Important points about the AS3 Object class:
23 // prototype is a static, read-only property. It doesn't have the same
24 // role in AS3 as in AS2. You can assign properties to the prototype
25 // member, but you cannot change what it points to.
27 // The prototype property provides dynamic inheritance. Normally, inheritance
28 // is done using a Traits object (bytecode, not available to AS). These two
29 // mechanisms are separate.
31 package main {
33 import flash.display.MovieClip;
35 public class Main extends MovieClip {
38 DEJAGNU_OBJ;
40 public function Main() {
42 xcheck_equals(Object, "[class Object]");
43 check_equals(Object.prototype, "[object Object]");
44 xcheck_equals(Object.constructor, "[class Class]");
46 xcheck_equals(typeof(Object), "object");
47 check_equals(typeof(Object.prototype), "object");
48 xcheck_equals(typeof(Object.constructor), "object");
50 check(Object.prototype.hasOwnProperty("constructor"));
51 check(Object.prototype.hasOwnProperty("hasOwnProperty"));
52 check(Object.prototype.hasOwnProperty("isPrototypeOf"));
53 xcheck(Object.prototype.hasOwnProperty("propertyIsEnumerable"));
54 xcheck(Object.prototype.hasOwnProperty("setPropertyIsEnumerable"));
55 check(Object.prototype.hasOwnProperty("toString"));
56 check(Object.prototype.hasOwnProperty("valueOf"));
58 check(!Object.prototype.hasOwnProperty("__proto__"));
59 check(!Object.prototype.hasOwnProperty("prototype"));
61 check(Object.prototype.isPrototypeOf(MovieClip));
62 check(Object.prototype.isPrototypeOf(this));
64 var a = new Object();
65 check_equals(a, "[object Object]");
66 check(!a.hasOwnProperty("constructor"));
67 check(!a.hasOwnProperty("hasOwnProperty"));
68 check(!a.hasOwnProperty("isPrototypeOf"));
69 check(!a.hasOwnProperty("propertyIsEnumerable"));
70 check(!a.hasOwnProperty("setPropertyIsEnumerable"));
71 check(!a.hasOwnProperty("toString"));
72 check(!a.hasOwnProperty("valueOf"));
74 xcheck(!a.hasOwnProperty("__proto__"));
75 check(!a.hasOwnProperty("prototype"));
77 // This crashes the Adobe player 9.
78 // check(Object.isPrototypeOf(this));
81 totals(27);
82 done();