From b05fe5a899dfcef3847540626d7424b58bf090d2 Mon Sep 17 00:00:00 2001 From: Smooth Operator Date: Fri, 15 Nov 2024 09:59:53 -0500 Subject: [PATCH] also test the tutorials (#335) * also test the tutorials * fix tutorial by using trampoline() --- .github/workflows/ci.yml | 9 +++++++++ tutorial/cpstut2.nim | 6 ++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 564e02af..807c8645 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -137,6 +137,15 @@ jobs: env: NIM: ${{ matrix.compiler.name }} + - name: Tutorial + shell: bash + run: | + cd project + cd tutorial + balls '***' --path=".." --backend:c --mm:arc --mm:orc + env: + NIM: ${{ matrix.compiler.name }} + - name: Tests shell: bash run: | diff --git a/tutorial/cpstut2.nim b/tutorial/cpstut2.nim index d1fce4ac..8cf26bc6 100644 --- a/tutorial/cpstut2.nim +++ b/tutorial/cpstut2.nim @@ -6,14 +6,12 @@ import deques type MyCont = ref object of Continuation - + var work: Deque[Continuation] proc runWork() = while work.len > 0: - var c = work.popFirst() - while c.running: - c = c.fn(c) + discard trampoline work.popFirst() proc schedule(c: MyCont): MyCont {.cpsMagic.} = work.addLast c