{-# OPTIONS_GHC -fno-warn-type-defaults #-} import Test.Hspec (Spec, describe, it, shouldBe) import Test.Hspec.Runner (configFastFail, defaultConfig, hspecWith) import Beer (sing, verse) main :: IO () main = hspecWith defaultConfig {configFastFail = True} specs specs :: Spec specs = describe "beer-song" $ do -- As of 2016-07-30, there was no reference file -- for the test cases in `exercism/x-common`. describe "verse" $ do it "verse 8" $ verse 8 `shouldBe` verse_8 it "verse 2" $ verse 2 `shouldBe` verse_2 it "verse 1" $ verse 1 `shouldBe` verse_1 it "verse 0" $ verse 0 `shouldBe` verse_0 describe "sing" $ do it "song 8 6" $ sing 8 6 `shouldBe` song_8_6 it "song 3 0" $ sing 3 0 `shouldBe` song_3_0 where verse_8 = "8 bottles of beer on the wall, 8 bottles of beer.\nTake one down and pass it around, 7 bottles of beer on the wall.\n" verse_2 = "2 bottles of beer on the wall, 2 bottles of beer.\nTake one down and pass it around, 1 bottle of beer on the wall.\n" verse_1 = "1 bottle of beer on the wall, 1 bottle of beer.\nTake it down and pass it around, no more bottles of beer on the wall.\n" verse_0 = "No more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.\n" song_8_6 = "8 bottles of beer on the wall, 8 bottles of beer.\nTake one down and pass it around, 7 bottles of beer on the wall.\n\n7 bottles of beer on the wall, 7 bottles of beer.\nTake one down and pass it around, 6 bottles of beer on the wall.\n\n6 bottles of beer on the wall, 6 bottles of beer.\nTake one down and pass it around, 5 bottles of beer on the wall.\n\n" song_3_0 = "3 bottles of beer on the wall, 3 bottles of beer.\nTake one down and pass it around, 2 bottles of beer on the wall.\n\n2 bottles of beer on the wall, 2 bottles of beer.\nTake one down and pass it around, 1 bottle of beer on the wall.\n\n1 bottle of beer on the wall, 1 bottle of beer.\nTake it down and pass it around, no more bottles of beer on the wall.\n\nNo more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.\n\n"