guile-knots/tests/timeout.scm

22 lines
401 B
Scheme

(use-modules (tests)
(fibers)
(unit-test)
(knots timeout))
(run-fibers-for-tests
(lambda ()
(assert-equal
1
(with-fibers-timeout
(const 1)
#:timeout 10))
(assert-equal
2
(with-fibers-timeout
(lambda ()
(sleep 10))
#:timeout 0.1
#:on-timeout (const 2)))))
(display "timeout test finished successfully\n")