-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCallStackTests.hx
More file actions
58 lines (49 loc) · 1.39 KB
/
CallStackTests.hx
File metadata and controls
58 lines (49 loc) · 1.39 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package;
class CallStackTests {
var t:Main;
public function new(main:Main) {
t = main;
}
public function run() {
t.section("CallStackBasic");
checkCallStack();
t.section("CallStackException");
checkExceptionStack();
t.section("CallStackToString");
checkToString();
t.section("CallStackCopy");
checkCopy();
t.section("CallStackInCatch");
checkInCatch();
}
function checkCallStack() {
var stack = haxe.CallStack.callStack();
t.intEquals(0, stack.length, "callStack() returns empty array");
}
function checkExceptionStack() {
var stack = haxe.CallStack.exceptionStack();
t.intEquals(0, stack.length, "exceptionStack() returns empty array");
var stackFull = haxe.CallStack.exceptionStack(true);
t.intEquals(0, stackFull.length, "exceptionStack(true) returns empty array");
}
function checkToString() {
var stack = haxe.CallStack.callStack();
var str = haxe.CallStack.toString(stack);
t.stringEquals("", str, "toString() returns empty string");
}
function checkCopy() {
var stack = haxe.CallStack.callStack();
var cp = stack.copy();
t.intEquals(0, cp.length, "copy() of empty stack is empty");
}
function checkInCatch() {
var len = 0;
try {
throw new haxe.Exception("test");
} catch (e:haxe.Exception) {
var eStack = haxe.CallStack.exceptionStack();
len = eStack.length;
}
t.intEquals(0, len, "exceptionStack() in catch is empty");
}
}