Skip to content

Commit c012467

Browse files
committed
[tests] Add case for host class overrides
1 parent f24ae39 commit c012467

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package scripthost;
2+
3+
#if cpp
4+
@:keep class HostParent12376 {
5+
public function new() {}
6+
7+
public function methodA() {
8+
return "HostParent.methodA()";
9+
}
10+
}
11+
12+
@:keep class HostChild12376 extends HostParent12376 {
13+
override function methodA() {
14+
return "HostChild.methodA()";
15+
}
16+
17+
public function methodB() {
18+
return "HostChild.methodB()";
19+
}
20+
21+
public function methodC() {
22+
return "HostChild.methodC()";
23+
}
24+
}
25+
#end
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package unit.issues;
2+
3+
import scripthost.Issue12376;
4+
5+
class Issue12376 extends Test {
6+
#if cppia
7+
public function test() {
8+
var child:ScriptChild = new ScriptChild();
9+
eq('HostChild.methodA()', child.methodA());
10+
eq('ScriptChild.methodB()', child.methodB());
11+
eq('HostChild.methodC()', child.methodC());
12+
}
13+
#end
14+
}
15+
16+
#if cppia
17+
private class ScriptChild extends HostChild12376 {
18+
override function methodB() {
19+
return 'ScriptChild.methodB()';
20+
}
21+
}
22+
#end

0 commit comments

Comments
 (0)