guile-knots/tests/resource-pool.scm

27 lines
677 B
Scheme
Raw Normal View History

2024-11-19 18:43:43 +00:00
(use-modules (tests)
(fibers)
(unit-test)
(knots resource-pool))
(run-fibers-for-tests
(lambda ()
(let ((resource-pool (make-resource-pool
(lambda ()
2)
1)))
(assert-equal
(with-resource-from-pool resource-pool
res
res)
2))))
(let* ((error-constructor
(record-constructor &resource-pool-timeout))
(err
(error-constructor 'foo)))
(assert-equal
(resource-pool-timeout-error-pool err)
'foo))
2024-11-19 18:43:43 +00:00
(display "resource-pool test finished successfully\n")