X-Git-Url: https://jxself.org/git/?p=8sync.git;a=blobdiff_plain;f=tests.scm;h=d56b4f2af73dbaddbf33584e75f3f09e043b0db2;hp=e438fc70836997b44457f8f72637d3478418b987;hb=06111cedb79268f25fefd62e73ddb1651a66f04b;hpb=cc3001a104f7e2f75858737eb930343c4a8b7999 diff --git a/tests.scm b/tests.scm index e438fc7..d56b4f2 100644 --- a/tests.scm +++ b/tests.scm @@ -246,6 +246,29 @@ (test-equal (speaker) '("I bet I can make you say you're a dummy!\n"))) +;; delimited continuation tests + +(define (return-monkey) + (speaker "(Hint, it's a monkey...)\n") + 'monkey) + +(define (talk-about-the-zoo) + (speaker "Today I went to the zoo and I saw...\n") + (speaker + (string-concatenate + `("A " ,(symbol->string (%sync (%run (return-monkey)))) "!\n")))) + +(let ((q (make-q))) + (set! speaker (speak-it)) + (enq! q talk-about-the-zoo) + ;; (enq! q talk-about-the-zoo-but-wait) + (start-agenda (make-agenda #:queue q) + #:stop-condition (true-after-n-times 10)) + (test-equal (speaker) + '("Today I went to the zoo and I saw...\n" + "(Hint, it's a monkey...)\n" + "A monkey!\n"))) + ;; End tests (test-end "tests")