55///|
66test " async_run_executes_function_immediately " {
77 let vm = MoonBitVM ::new()
8- ignore( vm.eval ("fn run_async(f : async () -> Unit noraise) = \"%async.run\"") )
8+ vm.run ("fn run_async(f : async () -> Unit noraise) = \"%async.run\"")
99 inspect(vm.eval("run_async(() => 7)"), content="7")
1010}
1111
1212///|
1313test " async_suspend_success " {
1414 let vm = MoonBitVM ::new()
15- ignore(
16- vm.eval(
17- (
18- #|async fn[T , E : Error ] async_suspend(
19- #| cb : ((T ) -> Unit , (E ) -> Unit ) -> Unit ,
20- #|) -> T raise E = "%async.suspend"
21- ),
15+ vm.run(
16+ (
17+ #|async fn[T , E : Error ] async_suspend(
18+ #| cb : ((T ) -> Unit , (E ) -> Unit ) -> Unit ,
19+ #|) -> T raise E = "%async.suspend"
2220 ),
2321 )
2422 inspect(vm.eval("async_suspend((ok, _err) => ok(42))"), content="42")
@@ -27,13 +25,11 @@ test "async_suspend_success" {
2725///|
2826test " async_suspend_error_branch " {
2927 let vm = MoonBitVM ::new()
30- ignore(
31- vm.eval(
32- (
33- #|async fn[T , E : Error ] async_suspend(
34- #| cb : ((T ) -> Unit , (E ) -> Unit ) -> Unit ,
35- #|) -> T raise E = "%async.suspend"
36- ),
28+ vm.run(
29+ (
30+ #|async fn[T , E : Error ] async_suspend(
31+ #| cb : ((T ) -> Unit , (E ) -> Unit ) -> Unit ,
32+ #|) -> T raise E = "%async.suspend"
3733 ),
3834 )
3935 inspect(
@@ -54,13 +50,11 @@ test "async_suspend_error_branch" {
5450///|
5551test " async_suspend_callback_not_resolved " {
5652 let vm = MoonBitVM ::new()
57- ignore(
58- vm.eval(
59- (
60- #|async fn[T , E : Error ] async_suspend(
61- #| cb : ((T ) -> Unit , (E ) -> Unit ) -> Unit ,
62- #|) -> T raise E = "%async.suspend"
63- ),
53+ vm.run(
54+ (
55+ #|async fn[T , E : Error ] async_suspend(
56+ #| cb : ((T ) -> Unit , (E ) -> Unit ) -> Unit ,
57+ #|) -> T raise E = "%async.suspend"
6458 ),
6559 )
6660 assert_eq(
@@ -78,13 +72,11 @@ test "async_suspend_callback_not_resolved" {
7872///|
7973test " async_suspend_first_callback_wins " {
8074 let vm = MoonBitVM ::new()
81- ignore(
82- vm.eval(
83- (
84- #|async fn[T , E : Error ] async_suspend(
85- #| cb : ((T ) -> Unit , (E ) -> Unit ) -> Unit ,
86- #|) -> T raise E = "%async.suspend"
87- ),
75+ vm.run(
76+ (
77+ #|async fn[T , E : Error ] async_suspend(
78+ #| cb : ((T ) -> Unit , (E ) -> Unit ) -> Unit ,
79+ #|) -> T raise E = "%async.suspend"
8880 ),
8981 )
9082 inspect(
0 commit comments