@@ -5,7 +5,7 @@ import Prelude (Unit, Ordering(..), (==), ($), discard, negate, not, (/=), (&&))
55import Control.Monad.Eff (Eff )
66import Control.Monad.Eff.Console (CONSOLE , log )
77
8- import Data.Maybe (Maybe (..), isNothing , maybe )
8+ import Data.Maybe (Maybe (..), isNothing )
99import Data.String
1010
1111import Test.Assert (ASSERT , assert )
@@ -160,19 +160,17 @@ testString = do
160160 assert $ split (Pattern " d" ) " abc" == [" abc" ]
161161
162162 log " splitAt"
163- let testSplitAt i str res =
163+ let testSplitAt i str r =
164164 assert $ case splitAt i str of
165- Nothing ->
166- isNothing res
167- Just { before, after } ->
168- maybe false (\r ->
169- r.before == before && r.after == after) res
170-
171- testSplitAt 1 " " Nothing
172- testSplitAt 0 " a" $ Just {before: " " , after: " a" }
173- testSplitAt 1 " ab" $ Just {before: " a" , after: " b" }
174- testSplitAt 3 " aabcc" $ Just {before: " aab" , after: " cc" }
175- testSplitAt (-1 ) " abc" $ Nothing
165+ { before, after } ->
166+ r.before == before && r.after == after
167+
168+ testSplitAt 1 " " { before: " " , after: " " }
169+ testSplitAt 0 " a" { before: " " , after: " a" }
170+ testSplitAt 1 " a" { before: " a" , after: " " }
171+ testSplitAt 1 " ab" { before: " a" , after: " b" }
172+ testSplitAt 3 " aabcc" { before: " aab" , after: " cc" }
173+ testSplitAt (-1 ) " abc" { before: " " , after: " abc" }
176174
177175 log " toCharArray"
178176 assert $ toCharArray " " == []
0 commit comments