From 08298703a8a611a52a3d345dfe6978876b36d773 Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Sat, 24 Aug 2019 01:40:11 +0000 Subject: [PATCH] Test busted flo:set-environment!. --- tests/runtime/test-floenv.scm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/runtime/test-floenv.scm b/tests/runtime/test-floenv.scm index 5390ec864..4339e390c 100644 --- a/tests/runtime/test-floenv.scm +++ b/tests/runtime/test-floenv.scm @@ -571,3 +571,24 @@ USA. ;; Test the exceptions. They should actually be cleared. (flo:test-exceptions (flo:supported-exceptions)))))) 0))) + +(define-test 'set-environment + (lambda () + (define x0) + (define x1) + (define x2) + (define x3) + (flo:preserving-environment + (lambda () + (flo:clear-exceptions! (flo:supported-exceptions)) + (set! x0 (flo:test-exceptions (flo:supported-exceptions))) + (let ((env (flo:environment))) + (set! x1 (flo:test-exceptions (flo:supported-exceptions))) + (flo:raise-exceptions! (flo:exception:divide-by-zero)) + (set! x2 (flo:test-exceptions (flo:supported-exceptions))) + (flo:set-environment! env) + (set! x3 (flo:test-exceptions (flo:supported-exceptions)))))) + (assert-eqv x0 0) + (assert-eqv x1 0) + (assert-eqv x2 (flo:exception:divide-by-zero)) + (expect-failure (lambda () (assert-eqv x3 0))))) \ No newline at end of file -- 2.25.1