Skip to content

Commit d8f4f8b

Browse files
committed
[cppia] Add test for host class method call
This covers the CallHaxe bug
1 parent a22d2f1 commit d8f4f8b

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

test/cppia/Client.hx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,13 @@ class Client
203203
default:
204204
}
205205

206+
switch LocalFunctionExceptions.testHostClassMethodOnHostReturn() {
207+
case Error(message):
208+
Common.status = 'Failed test for running host class method on returned value: ' + message;
209+
return;
210+
default:
211+
}
212+
206213
// regression test for #926
207214
var x:Dynamic = 3;
208215
x *= 5;

test/cppia/Common.hx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ class Common
88
public static var callbackSet:Int = 0;
99
public static var callback: Void->Void;
1010

11+
public function dummyMethod() {}
1112
}

test/cppia/LocalFunctionExceptions.hx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,22 @@ class LocalFunctionExceptions {
105105

106106
return Error("No exception caught");
107107
}
108+
109+
public static function testHostClassMethodOnHostReturn():Status {
110+
function localFunction() {
111+
(staticFunction() : Common).dummyMethod();
112+
}
113+
114+
try {
115+
localFunction();
116+
} catch (e:String) {
117+
if (e == 'Thrown from static') {
118+
return Ok;
119+
} else {
120+
return Error("Incorrect exception caught from local function call: " + e);
121+
}
122+
}
123+
124+
return Error("No exception caught");
125+
}
108126
}

0 commit comments

Comments
 (0)