Skip to content

Commit

Permalink
also test the tutorials (#335)
Browse files Browse the repository at this point in the history
* also test the tutorials

* fix tutorial by using trampoline()
  • Loading branch information
disruptek authored Nov 15, 2024
1 parent 5f93be8 commit b05fe5a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
6 changes: 2 additions & 4 deletions tutorial/cpstut2.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b05fe5a

Please sign in to comment.