aboutsummaryrefslogtreecommitdiffstats
path: root/tests/run.scm
diff options
context:
space:
mode:
authorGravatar Peter McGoron 2025-02-24 18:34:34 -0500
committerGravatar Peter McGoron 2025-02-24 18:34:34 -0500
commit17d536e4437f6534a453bd1bfc6cd15c0f077224 (patch)
tree424d2310a0358aa67207843c20479a21b0583e6c /tests/run.scm
parenttest local scope override of dynamic scope subtyping (diff)
fix subtyping insertion for global tables
Diffstat (limited to '')
-rw-r--r--tests/run.scm16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/run.scm b/tests/run.scm
index 392dac6..9825c30 100644
--- a/tests/run.scm
+++ b/tests/run.scm
@@ -194,4 +194,20 @@
(letrec-SAHP ((sub ('rational (lambda (x) 2))))
(test-equal 2 (sub 0))
(test-equal 2 (sub 1/2))
+ (test-equal 1 (sub 1+2i))))))
+ (test-group "global scope"
+ (define-global-SAHP (sub ('number x))
+ 1)
+ (test-group "subtypes flow downwards"
+ (test-for-all))
+ (test-group "dynamic scope overrides global scope"
+ (parameterize-SAHP ((sub ('rational (lambda (x) 2))))
+ (test-equal 2 (sub 0))
+ (test-equal 2 (sub 1/2))
+ (test-equal 1 (sub 1+2i))))
+ (test-group "local scope overrides dynamic scope overrides global scope"
+ (parameterize-SAHP ((sub ('rational (lambda (x) 2))))
+ (letrec-SAHP ((sub ('integer (lambda (x) 3))))
+ (test-equal 3 (sub 0))
+ (test-equal 2 (sub 1/2))
(test-equal 1 (sub 1+2i)))))))