aboutsummaryrefslogtreecommitdiff
path: root/tests/timeout.scm
blob: bab39d2d6f59a845dca947d3e651c5c6408eca9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
(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")