racket/collects/tests/web-server/scheme-units/test-channel.ss
Eli Barzilay 7d50e61c7f * Newlines at EOFs
* Another big chunk of v4-require-isms
* Allow `#lang framework/keybinding-lang' for keybinding files
* Move hierlist sources into "mrlib/hierlist", leave stub behind

svn: r10689
2008-07-09 07:18:06 +00:00

29 lines
1.1 KiB
Scheme

;; Mike Burns, July 8th, 2004, netgeek@speakeasy.net
;; Test async-channel:
(module test-channel mzscheme
(require schemeunit/test
web-server/channel)
(provide test-channel)
(define test-channel
(let ((c (make-async-channel))
(v (gensym)))
(make-test-suite
"Test async-channel"
(make-test-case
"async-channel-get-available of the empty channel"
(assert-eq? (void) (async-channel-get-available c (lambda (x) #f))))
(make-test-case
"async-channel-get-available of the non-empty channel"
(assert-false (begin (async-channel-put c v)
(async-channel-get-available c (lambda (x) #f)))))
(make-test-case
"async-channel-try-get of the empty channel"
(assert-false (async-channel-try-get c (lambda () #f))))
(make-test-case
"async-channel-try-get of the non-empty channel"
(assert-eq? v (begin (async-channel-put c v)
(async-channel-try-get c (lambda () #f))))))))
)