Files
Viper_RegressionTesting/CoroTest/App/main.vp
T
TermiNexus f5da836fbb chore(test): 迁移测试夹具到新语法
机械规则 R2/R3/R4/R6/R7/R8/R13 + R16 保守子集,共 86 文件 2127 行。R1(T | t.CPtr)与 R12(while 下标循环)未做,仍列为待办。全量 77/77 顺序回归通过。
2026-10-05 19:59:02 +08:00

41 lines
774 B
Plaintext

import t, c
from stdint import *
import stdio
import coro
class MyError(Exception):
pass
async def leaf(x: int) -> int:
return x + 1
async def boom() -> int:
raise MyError("boom msg")
return 0
async def task() -> int:
fin: int = 0
try:
fin = 1
await boom()
finally:
fin = fin + 1
stdio.printf("finally ran, fin = %d\n", fin)
return 99
def main() -> int:
n: int = 0
for i in range(3):
tt: coro.Coroutine = coro.Coroutine(*&task())
r: int = coro.coro_run(tt)
e: int = coro.coro_exception(tt)
m: t.CPtr = coro.coro_exception_msg(tt)
stdio.printf("[%d] r = %d, exc = %d, msg = %s\n", i, r, e, m)
coro.coro_destroy(tt)
n = n + 1
return 0