Update with current status
[gnash.git] / testsuite / misc-mtasc.all / super_test1.as
blob325988d52abfaeb2ccbb6b165b72497109179804
1 // levels.as - MTASC testcase for loading into _level targets
2 //
3 // Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software
4 // Foundation, Inc
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 3 of the License, or
9 // (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 // zou lunkai zoulunkai@gmail.com
22 //
23 // Test super in a mutilevel inheritance context(Base1.Derived1.Derived11).
25 #include "check.as"
27 import Derived1;
29 class Derived11 extends Derived1
31 var derived11CtorCalled;
32 var thisPtr;
33 var derived11DirectCalled;
34 var derived11ViaApplyCalled;
36 // constructor
37 function Derived11()
39 super();
40 this.derived11CtorCalled = true;
41 thisPtr = this;
44 function direct()
46 super.direct();
47 this.derived11DirectCalled = true;
50 function viaApply()
52 super.viaApply();
53 this.derived11ViaApplyCalled = true;
56 static function main()
58 // Gnash got an unexpected 'ActionLimit hit' here.
59 var derivedObj = new Derived11();
61 // check that all constructors in the inheritance chain are called.
62 check_equals(derivedObj.baseCtorCalled, true);
63 check_equals(derivedObj.derived1CtorCalled, true);
64 check_equals(derivedObj.derived11CtorCalled, true);
66 // check that all "super.method()" in the inheritance chain are called.
67 derivedObj.direct();
68 check_equals(derivedObj.baseDirectCalled, true);
69 check_equals(derivedObj.derived1DirectCalled, true);
70 check_equals(derivedObj.derived11DirectCalled, true);
72 // check that all "super.method()" in the inheritance chain are called
73 // when "apply()" is used to call the derived method.
74 var method = derivedObj.viaApply;
75 method.apply(derivedObj);
76 check_equals(derivedObj.baseViaApplyCalled, true);
77 check_equals(derivedObj.derived1ViaApplyCalled, true);
78 check_equals(derivedObj.derived11ViaApplyCalled, true);
80 // check this pointers.
81 check_equals(derivedObj.thisPtr, derivedObj);
82 check_equals(derivedObj.derivedThisPtr, derivedObj);
83 check_equals(derivedObj.baseThisPtr, derivedObj);
85 check_totals(12);
86 Dejagnu.done();