haxe-coroutines
haxe-coroutines copied to clipboard
Test cases for yield and async/await
In our implementation we mimic C# approach, so there are some Task
api calls in these tests which should be replaced as you adopt them to you syntax.
Awesome, thanks a lot!
I'm currently looking into adding (some of these) tests. Using the yield implementation from our misc tests makes quite a few things work already. Some observations:
-
The tests expect
Iterable
while our yield isIterator
. I find the latter more intuitive for because generators are not really data structures, which is what I associate withIterable
. -
However, this test currently doesn't work:
var generator = basicYieldReturn();
assert([10, 20], generator);
assert([10, 20], generator);
I'm not sure what the semantics are supposed to be here.
- I don't know what
@:yield break;
is.
Ok so it seems like @:yield break
is actually just supposed to be return
. As in actual return, not yield-return. I replaced all occurrences and the tests pass.
Other than the aforementioned multiple-iterations failure (and some disabled tests that relied on __ctx__
from the original build macro), the only other failures are related to exceptions and will probably be solved when we figure out what I talk about here.
What is hxasync
uh.. library? used here?
There's a lib called hxasync
nowadays but it seems very unrelated and was created years after this PR.