mirror of
https://github.com/gryf/tagbar.git
synced 2026-02-24 19:25:49 +01:00
Add tests to repository
This commit is contained in:
23
tests/vala/closures.vala
Normal file
23
tests/vala/closures.vala
Normal file
@@ -0,0 +1,23 @@
|
||||
delegate int Func ();
|
||||
|
||||
[CCode (has_target = false)]
|
||||
delegate void NoTargetFunc ();
|
||||
|
||||
int A (int k, Func x1, Func x2, Func x3, Func x4, Func x5) {
|
||||
Func B = null;
|
||||
B = () => {
|
||||
k = k - 1;
|
||||
return A (k, B, x1, x2, x3, x4);
|
||||
};
|
||||
return k <= 0 ? x4 () + x5 () : B ();
|
||||
}
|
||||
|
||||
void B ([CCode (array_length = false, array_null_terminated = true)] int[] array, NoTargetFunc func) {
|
||||
Func C = () => { array = null; func (); return 0; };
|
||||
}
|
||||
|
||||
void main () {
|
||||
int result = A (10, () => 1, () => -1, () => -1, () => 1, () => 0);
|
||||
assert (result == -67);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user