diff options
author | Eduardo Julian | 2019-02-05 19:09:31 -0400 |
---|---|---|
committer | Eduardo Julian | 2019-02-05 19:09:31 -0400 |
commit | 47b97c128bde837fa803a605f3e011a3e9ddd71c (patch) | |
tree | 5e8a84d1b1812ec4a157d4049c778ec2e4e434c4 /stdlib/source/test/lux/data/identity.lux | |
parent | be5710d104e6ee085dcb9d871be0b80305e48f8b (diff) |
Integrated tests into normal source code.
Diffstat (limited to 'stdlib/source/test/lux/data/identity.lux')
-rw-r--r-- | stdlib/source/test/lux/data/identity.lux | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/stdlib/source/test/lux/data/identity.lux b/stdlib/source/test/lux/data/identity.lux new file mode 100644 index 000000000..31bf105cd --- /dev/null +++ b/stdlib/source/test/lux/data/identity.lux @@ -0,0 +1,37 @@ +(.module: + [lux #* + [control + ["M" monad (#+ Monad do)] + comonad] + [data + ["&" identity] + [text ("text/." monoid equivalence)]]] + lux/test) + +(context: "Identity" + (let [(^open "&/.") &.apply + (^open "&/.") &.monad + (^open "&/.") &.comonad] + ($_ seq + (test "Functor does not affect values." + (text/= "yololol" (&/map (text/compose "yolo") "lol"))) + + (test "Apply does not affect values." + (and (text/= "yolo" (&/wrap "yolo")) + (text/= "yololol" (&/apply (&/wrap (text/compose "yolo")) (&/wrap "lol"))))) + + (test "Monad does not affect values." + (text/= "yololol" (do &.monad + [f (wrap text/compose) + a (wrap "yolo") + b (wrap "lol")] + (wrap (f a b))))) + + (test "CoMonad does not affect values." + (and (text/= "yololol" (&/unwrap "yololol")) + (text/= "yololol" (be &.comonad + [f text/compose + a "yolo" + b "lol"] + (f a b))))) + ))) |