From 06111cedb79268f25fefd62e73ddb1651a66f04b Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Sat, 21 Nov 2015 21:34:16 -0600 Subject: [PATCH] first delimited continuation test --- tests.scm | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) 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") -- 2.31.1