From 038b220675ab24b59ce4ebf42949b4b4beb2d659 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Thu, 4 Apr 2019 21:12:25 -0400 Subject: Fixed a bug when pattern matching against "Error" values. --- stdlib/source/test/lux/data/error.lux | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'stdlib/source/test') diff --git a/stdlib/source/test/lux/data/error.lux b/stdlib/source/test/lux/data/error.lux index 9012b3212..c60c6563a 100644 --- a/stdlib/source/test/lux/data/error.lux +++ b/stdlib/source/test/lux/data/error.lux @@ -32,12 +32,12 @@ (def: #export (error element) (All [a] (-> (Random a) (Random (Error a)))) ($_ r.or - (:: r.monad wrap "KABOOM!") + (r.unicode 1) element)) (def: #export test Test - (<| (_.context (%name (name-of /.Error))) + (<| (_.context (%name (name-of /._))) ($_ _.and ($equivalence.spec (/.equivalence nat.equivalence) (..error r.nat)) ($functor.spec ..injection ..comparison /.functor) @@ -48,17 +48,16 @@ right r.nat #let [expected (n/+ left right) (^open "io@.") io.monad]] - (let [] - (_.test "Can add error functionality to any monad." - (let [lift (/.lift io.monad)] - (|> (do (/.with io.monad) - [a (lift (io@wrap left)) - b (wrap right)] - (wrap (n/+ a b))) - io.run - (case> (#/.Success actual) - (n/= expected actual) + (_.test "Can add error functionality to any monad." + (let [lift (/.lift io.monad)] + (|> (do (/.with io.monad) + [a (lift (io@wrap left)) + b (wrap right)] + (wrap (n/+ a b))) + io.run + (case> (#/.Success actual) + (n/= expected actual) - _ - #0)))))) + _ + false))))) ))) -- cgit v1.2.3