1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -Wno-orphans #-}
module Features.StrictBuilder (tests) where
#if MIN_VERSION_text(2,0,2) && !MIN_VERSION_text(2,1,2)
import Data.Function
import Data.Proxy
import qualified Data.Text.Encoding as TextEncoding
import Test.QuickCheck.Instances ()
import Test.Tasty
import Test.Tasty.QuickCheck
import TextBuilderDev
import Util.TestTrees
import Prelude
tests :: [TestTree]
tests =
[ isomorphic $
Proxy @TextEncoding.StrictBuilder,
testGroup "to" $
[ mapsToMonoid (to @TextEncoding.StrictBuilder),
mapsToMonoid (from @TextEncoding.StrictBuilder)
]
]
instance Eq TextEncoding.StrictBuilder where
a == b =
on (==) TextEncoding.strictBuilderToText a b
instance Show TextEncoding.StrictBuilder where
showsPrec d =
showsPrec d . TextEncoding.strictBuilderToText
instance Arbitrary TextEncoding.StrictBuilder where
arbitrary =
TextEncoding.textToStrictBuilder <$> arbitrary
#else
import Test.Tasty
tests :: [TestTree]
tests = []
#endif
|