summaryrefslogtreecommitdiff
path: root/test-suite
diff options
context:
space:
mode:
authorRob Browning <rlb@defaultvalue.org>2019-12-08 11:35:37 -0600
committerAndy Wingo <wingo@pobox.com>2020-01-12 22:04:55 +0100
commit5d2956497137c2f7453e21d334d152bfd91a3ef8 (patch)
tree16388cc8e3a6c303ccb0c0cd1c4514cf75e48e5b /test-suite
parentaa0bfa2f9387262ad972674c4d1d88e0e3d863b3 (diff)
Respect thread local fluid defaults
Previously (fluid-ref (make-thread-local-fluid #t)) would return #f via scm_fluid_ref because the internal scm_hashq_ref would return #f when the fluid had not been set, and that was interpreted as an actual value for the fluid. Instead, just pass the fluid default as the default for the hash table lookups so that we don't need a second step to determine if the fluid was set. Thanks to Andrew Gierth for tracking down the problem.
Diffstat (limited to 'test-suite')
-rw-r--r--test-suite/tests/fluids.test14
1 files changed, 12 insertions, 2 deletions
diff --git a/test-suite/tests/fluids.test b/test-suite/tests/fluids.test
index a5ca8857e..949d50410 100644
--- a/test-suite/tests/fluids.test
+++ b/test-suite/tests/fluids.test
@@ -49,8 +49,18 @@
(interaction-environment))))
(with-test-prefix "initial fluid values"
- (pass-if "fluid-ref uninitialized fluid is #f"
- (not (fluid-ref a)))
+
+ (pass-if "fluid-ref returns #f for uninitialized fluid"
+ (eq? #f (fluid-ref (make-fluid))))
+
+ (pass-if "fluid-ref returns #f for uninitialized thread local fluid"
+ (eq? #f (fluid-ref (make-thread-local-fluid))))
+
+ (pass-if "fluid-ref returns default"
+ (eq? #t (fluid-ref (make-fluid #t))))
+
+ (pass-if "fluid-ref returns thread local default"
+ (eq? #t (fluid-ref (make-thread-local-fluid #t))))
(pass-if "initial value is inherited from parent thread"
(if (provided? 'threads)