{-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-} module Headroom.Header.SanitizeSpec ( spec ) where import Headroom.Configuration.Types ( HeaderSyntax(..) ) import Headroom.Data.Regex ( re ) import Headroom.Data.Text ( fromLines ) import Headroom.Header.Sanitize import RIO import Test.Hspec spec :: Spec spec = do describe "findPrefix" $ do it "finds and fills line prefix to LineComment header syntax" $ do let s = [re|^--|] sample = fromLines ["-- first", "", "-- second", "-- third"] syntax = LineComment s Nothing expected = LineComment s (Just "--") findPrefix syntax sample `shouldBe` expected it "finds and fills line prefix to BlockComment header syntax" $ do let s = [re|^{-\||] e = [re|(?