text-builder 0.5 → 0.5.1
raw patch · 3 files changed
+14/−8 lines, 3 files
Files
- library/Text/Builder.hs +2/−4
- tests/Main.hs +11/−3
- text-builder.cabal +1/−1
library/Text/Builder.hs view
@@ -105,13 +105,11 @@ {-# INLINABLE text #-} text :: Text -> Builder text (C.Text array offset length) =- Builder action actualLength+ Builder action length where action = Action $ \builderArray builderOffset -> do- B.copyI builderArray builderOffset array offset (builderOffset + actualLength)- actualLength =- length - offset+ B.copyI builderArray builderOffset array offset (builderOffset + length) {-# INLINE string #-} string :: String -> Builder
tests/Main.hs view
@@ -14,19 +14,27 @@ testGroup "All tests" $ [ testProperty "Packing a list of chars is isomorphic to appending a list of builders" $- \chars ->+ \ chars -> A.pack chars === B.run (foldMap B.char chars) , testProperty "Concatting a list of texts is isomorphic to fold-mapping with builders" $- \texts ->+ \ texts -> mconcat texts === B.run (foldMap B.text texts) , testProperty "Concatting a list of texts is isomorphic to concatting a list of builders" $- \texts ->+ \ texts -> mconcat texts === B.run (mconcat (map B.text texts))+ ,+ testProperty "Concatting a list of trimmed texts is isomorphic to concatting a list of builders" $+ \ texts ->+ let+ trimmedTexts = fmap (A.drop 3) texts+ in+ mconcat trimmedTexts ===+ B.run (mconcat (map B.text trimmedTexts)) , testProperty "Decimal" $ \ (x :: Integer) -> (fromString . show) x === (B.run (B.decimal x))
text-builder.cabal view
@@ -1,7 +1,7 @@ name: text-builder version:- 0.5+ 0.5.1 category: Text synopsis: