guile-knots/tests/timeout.scm

23 lines
401 B
Scheme
Raw Permalink Normal View History

2024-11-19 18:43:43 +00:00
(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")