29 lines
762 B
Scheme
29 lines
762 B
Scheme
(define-module (tests)
|
|
#:use-module (ice-9 exceptions)
|
|
#:use-module (fibers)
|
|
#:export (run-fibers-for-tests
|
|
assert-no-heap-growth))
|
|
|
|
(define (run-fibers-for-tests thunk)
|
|
(let ((result
|
|
(run-fibers
|
|
(lambda ()
|
|
(with-exception-handler
|
|
(lambda (exn)
|
|
exn)
|
|
(lambda ()
|
|
(with-exception-handler
|
|
(lambda (exn)
|
|
(backtrace)
|
|
(raise-exception exn))
|
|
thunk)
|
|
#t)
|
|
#:unwind? #t))
|
|
#:hz 0
|
|
#:parallelism 1)))
|
|
(if (exception? result)
|
|
(raise-exception result)
|
|
result)))
|
|
|
|
(define (assert-no-heap-growth thunk)
|
|
(thunk))
|