reddit-pub/reddit_tags/test/MyLibTest.hs

18 lines
554 B
Haskell
Raw Normal View History

2022-05-16 22:49:54 +03:00
{-# LANGUAGE OverloadedStrings #-}
2022-05-16 21:49:01 +03:00
module Main (main) where
2022-05-16 22:49:54 +03:00
import Tags (parseTags)
import Test.Hspec
2022-05-16 21:49:01 +03:00
main :: IO ()
2022-05-16 22:49:54 +03:00
main = hspec $
describe "Parser" $ do
it "Returns no results if there are no tags" $
parseTags "foo bar" `shouldBe` []
it "Returns a single result" $
parseTags "[foo]" `shouldBe` ["foo"]
it "Finds multiple results" $
parseTags "[foo][bar]" `shouldBe` ["foo", "bar"]
it "Finds multiple results with other text interleaved" $
parseTags "prefix [foo] infix [bar] suffix" `shouldBe` ["foo", "bar"]