Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
axionbuster committed Dec 18, 2024
1 parent 509e3ca commit 19b870d
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions test/Spec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,17 @@ addOne = (+ 1)
add :: Int -> Int -> Int
add x y = x + y

concat3 :: String -> String -> String -> String
concat3 x y z = x ++ y ++ z
compose0 :: Int -> String
compose0 = toString .**. addOne

compose1 :: Int -> Int -> String
compose1 = toString .**. add

main :: IO ()
main = hspec $ do
describe "Variadic composition" $ do
it "works with single argument functions" $ do
(toString .**. addOne) 5 `shouldBe` "6"
compose0 5 `shouldBe` "6"

it "works with two argument functions" $ do
(toString .**. add) 1 2 `shouldBe` "3"

it "works with three argument functions" $ do
(toString .**. concat3) "a" "b" "c" `shouldBe` "abc"

it "maintains function behavior" $ do
let f = toString .**. addOne
let g = toString . addOne
f 10 `shouldBe` g 10
compose1 1 2 `shouldBe` "3"

0 comments on commit 19b870d

Please sign in to comment.