From 909bc37ba2b96f12eb1eeb0ebed87994a46beb43 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sat, 29 Jul 2017 10:50:20 -0400 Subject: - Renamed "Thunk" to "Lazy", and moved it from lux/control/thunk to lux/data/lazy. --- stdlib/test/test/lux/control/thunk.lux | 23 ----------------------- stdlib/test/test/lux/data/lazy.lux | 23 +++++++++++++++++++++++ stdlib/test/tests.lux | 2 +- 3 files changed, 24 insertions(+), 24 deletions(-) delete mode 100644 stdlib/test/test/lux/control/thunk.lux create mode 100644 stdlib/test/test/lux/data/lazy.lux (limited to 'stdlib/test') 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] -- cgit v1.2.3