Simplify code
This commit is contained in:
@ -10,7 +10,7 @@ main :: IO ()
|
||||
main = hspec spec
|
||||
|
||||
spec :: Spec
|
||||
spec =
|
||||
spec = do
|
||||
describe "Splitting" $ do
|
||||
it "can process empty string" $ wordsWhen (== '-') "" `shouldBe` []
|
||||
it "can process only one word" $ wordsWhen (== '-') "10" `shouldBe` ["10"]
|
||||
@ -18,3 +18,9 @@ spec =
|
||||
wordsWhen (== '-') "10-20" `shouldBe` ["10", "20"]
|
||||
it "can be separated by ','" $
|
||||
wordsWhen (== ',') "10,20,30" `shouldBe` ["10", "20", "30"]
|
||||
-- Test splitIntoTwoWords
|
||||
describe "Splitting into two words" $ do
|
||||
it "can process empty string" $
|
||||
splitIntoTwoWords (== '-') "" `shouldBe` ("", "")
|
||||
it "can process normal string" $
|
||||
splitIntoTwoWords (== '-') "1-2" `shouldBe` ("1", "2")
|
||||
|
Reference in New Issue
Block a user