packages feed

darkplaces-text 0.2 → 0.2.1

raw patch · 3 files changed

+15/−6 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

darkplaces-text.cabal view
@@ -1,5 +1,5 @@ name:                darkplaces-text-version:             0.2+version:             0.2.1 license:             GPL-2 license-file:        LICENSE author:              Slava Bacherikov@@ -54,7 +54,7 @@                        QuickCheck >= 2.5,                        hspec -  default-extensions:  OverloadedStrings+  default-extensions:  OverloadedStrings, FlexibleInstances  source-repository head   type:                git
src/DarkPlaces/Text/Types.hs view
@@ -7,6 +7,7 @@ import System.Console.ANSI import System.IO (Handle, hPutChar) import Data.Monoid+import Text.Printf import Data.String import Numeric @@ -126,7 +127,7 @@     repr DPNewline = fromString "\n"     repr (DPString s) = s     repr (SimpleColor c) = fromString $ "^" ++ show c-    repr (HexColor c) = fromString $ "^x" ++ showHex c ""+    repr (HexColor c) = fromString $ printf "^x%03X" c   optimizeDPText :: (Monoid a) => DPText a -> DPText a
tests/DarkPlaces/TextSpec.hs view
@@ -16,18 +16,26 @@     arbitrary = BL.pack <$> arbitrary  -instance (Arbitrary a) => Arbitrary (DPTextToken a) where+instance Arbitrary (DPTextToken BL.ByteString) where     arbitrary = do         t <- choose (0, 3) :: Gen Int         case t of             0 -> SimpleColor <$> choose (0, 9)             1 -> HexColor <$> choose (0, 0xFFF)-            2 -> DPString <$> arbitrary+            2 -> DPString <$> arWithNoTockens             3 -> return DPNewline  -instance (Arbitrary a) => Arbitrary (DPText a) where+instance Arbitrary (DPText BL.ByteString) where     arbitrary = DPText <$> arbitrary+++arWithNoTockens :: Gen BL.ByteString+arWithNoTockens = do+    res <- arbitrary+    case parseDPText res of+        DPText [DPString s] -> return s+        _                   -> arWithNoTockens   spec :: Spec