~eda-qa/dhlib/main

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* <license>
 * This file is part of the dis-Emi-A HaXe Library. Copyright © edA-qa mort-ora-y
 * For full copyright and license information please refer to doc/license.txt.
 * </license> 
 */
class MyClass
{
	static public function method1() : Int
	{
		return 5;
	}
}

class MySubClass extends MyClass
{
	static public function method1() : Int
	{
		return 7;
	}
}

class StaticCall  extends haxe.unit.TestCase
{
	public function testMain() 
	{
		check( MyClass, 5 );
		check( MySubClass, 7 );
	}
	
	function check<T>( c : Class<T>, res : Int )
	{
		var f = Reflect.field( c, "method1" );
		assertTrue( f != null );
		var q = Reflect.callMethod( c, f, [] );
		assertEquals( res, q );
	}
}