aboutsummaryrefslogtreecommitdiff
path: root/stdlib/test
diff options
context:
space:
mode:
authorEduardo Julian2017-07-29 10:50:20 -0400
committerEduardo Julian2017-07-29 10:50:20 -0400
commit909bc37ba2b96f12eb1eeb0ebed87994a46beb43 (patch)
tree27ed5b34e222429816af29020e27a7e4d759c6d3 /stdlib/test
parente92f7da685b9719f2aea67e4ebe630b98715368f (diff)
- Renamed "Thunk" to "Lazy", and moved it from lux/control/thunk to lux/data/lazy.
Diffstat (limited to 'stdlib/test')
-rw-r--r--stdlib/test/test/lux/control/thunk.lux23
-rw-r--r--stdlib/test/test/lux/data/lazy.lux23
-rw-r--r--stdlib/test/tests.lux2
3 files changed, 24 insertions, 24 deletions
diff --git a/stdlib/test/test/lux/control/thunk.lux b/stdlib/test/test/lux/control/thunk.lux
deleted file mode 100644
index 878cf4144..000000000
--- a/stdlib/test/test/lux/control/thunk.lux
+++ /dev/null
@@ -1,23 +0,0 @@
-(;module:
- lux
- (lux [io]
- (control ["M" monad #+ do Monad]
- ["&" thunk])
- ["R" math/random])
- lux/test)
-
-(context: "Thunks"
- [left R;nat
- right R;nat
- #let [thunk (&;freeze (n.* left right))
- expected (n.* left right)]]
- ($_ seq
- (test "Thunking does not alter the expected value."
- (n.= expected
- (&;thaw thunk)))
- (test "Thunks only evaluate once."
- (and (not (is expected
- (&;thaw thunk)))
- (is (&;thaw thunk)
- (&;thaw thunk))))
- ))
diff --git a/stdlib/test/test/lux/data/lazy.lux b/stdlib/test/test/lux/data/lazy.lux
new file mode 100644
index 000000000..bf395bcfa
--- /dev/null
+++ b/stdlib/test/test/lux/data/lazy.lux
@@ -0,0 +1,23 @@
+(;module:
+ lux
+ (lux [io]
+ (control ["M" monad #+ do Monad])
+ (data ["&" lazy])
+ ["R" math/random])
+ lux/test)
+
+(context: "Lazy."
+ [left R;nat
+ right R;nat
+ #let [lazy (&;freeze (n.* left right))
+ expected (n.* left right)]]
+ ($_ seq
+ (test "Lazying does not alter the expected value."
+ (n.= expected
+ (&;thaw lazy)))
+ (test "Lazy values only evaluate once."
+ (and (not (is expected
+ (: Nat (&;thaw lazy))))
+ (is (&;thaw lazy)
+ (&;thaw lazy))))
+ ))
diff --git a/stdlib/test/tests.lux b/stdlib/test/tests.lux
index c423502b7..a97229a10 100644
--- a/stdlib/test/tests.lux
+++ b/stdlib/test/tests.lux
@@ -22,7 +22,6 @@
["_;" cont]
["_;" reader]
["_;" state]
- ["_;" thunk]
["_;" parser])
(data ["_;" bit]
["_;" bool]
@@ -35,6 +34,7 @@
["_;" product]
["_;" sum]
["_;" text]
+ ["_;" lazy]
(number ["_;" ratio]
["_;" complex])
(format ["_;" json]