haxe-coroutines icon indicating copy to clipboard operation
haxe-coroutines copied to clipboard

Test cases for yield and async/await

Open RealyUniqueName opened this issue 6 years ago • 4 comments

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.

RealyUniqueName avatar Sep 18 '17 19:09 RealyUniqueName

Awesome, thanks a lot!

nadako avatar Sep 18 '17 19:09 nadako

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 is Iterator. I find the latter more intuitive for because generators are not really data structures, which is what I associate with Iterable.

  • 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.

Simn avatar Feb 15 '24 10:02 Simn

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.

Simn avatar Feb 15 '24 11:02 Simn

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.

kLabz avatar Feb 16 '24 20:02 kLabz