Update with current status
[gnash.git] / testsuite / misc-mtasc.all / implementsOpTest.as
blob793b8e3331dfb342cd6ce642bce1a4609e70a08b
1 // implementsOpTest.as - Entry point for the implementsOp test
2 //
3 // Copyright (C) 2007, 2009, 2010 Free Software 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
20 #include "check.as"
22 import implementsOp.SimpleInterface;
23 import implementsOp.ImplementationA;
24 import implementsOp.ImplementationB;
25 import implementsOp.BExtendingImplementation;
27 class implementsOpTest {
29 var objectA:SimpleInterface;
30 var objectB:SimpleInterface;
31 var objectC:SimpleInterface;
33 function implementsOpTest(testMethod:String) {
34 super(testMethod);
37 function test_all():Void {
39 check(!ImplementationA instanceof SimpleInterface);
40 check(!ImplementationA.prototype instanceof SimpleInterface);
41 check(!ImplementationB instanceof SimpleInterface);
42 check(!ImplementationA.prototype instanceof SimpleInterface);
43 check(!BExtendingImplementation instanceof ImplementationB);
44 check(BExtendingImplementation.prototype instanceof ImplementationB);
45 check(BExtendingImplementation.prototype instanceof SimpleInterface);
47 objectA = new ImplementationA();
48 objectB = new ImplementationB();
49 objectC = new BExtendingImplementation();
51 check(objectA instanceof ImplementationA);
52 check(objectA instanceof SimpleInterface);
54 check(objectB instanceof ImplementationB);
55 check(objectB instanceof SimpleInterface);
57 check(objectC instanceof BExtendingImplementation);
58 check(objectC instanceof ImplementationB);
59 check(objectC instanceof SimpleInterface);
62 // TODO: review the tests below
64 check_equals(100, objectA.doStuff(1, "foo"));
65 check_equals(100, objectA.doStuff(1, "foo"));
67 check_equals("param1 was foo", objectA.doMoreStuff("foo", 1));
69 check_equals(200, objectB.doStuff(1, "foo"));
71 check_equals("param2 was 1", objectB.doMoreStuff("foo", 1));
73 check_equals(objectB.doStuff(1, "foo"), objectC.doStuff(1, "foo"));
75 check_equals("overriding implementation", objectC.doMoreStuff("foo", 1));
77 // TODO: review the tests above
79 // drop the __proto_ member
80 objectA.__proto__ = null;
81 check(! objectA instanceof ImplementationA); // drops relation with its constructor
82 check(! objectA instanceof SimpleInterface); // drops relation with interfaces as well
86 static function main(mc)
88 var myTest = new implementsOpTest;
89 myTest.test_all();
91 check_totals(23);
92 Dejagnu.done();