packages feed

ascii-th 1.0.0.13 → 1.0.0.14

raw patch · 3 files changed

+64/−96 lines, 3 filesdep +hspecdep −hedgehogPVP ok

version bump matches the API change (PVP)

Dependencies added: hspec

Dependencies removed: hedgehog

API changes (from Hackage documentation)

Files

ascii-th.cabal view
@@ -1,7 +1,7 @@ cabal-version: 3.0  name: ascii-th-version: 1.0.0.13+version: 1.0.0.14 synopsis: Template Haskell support for ASCII category: Data, Text @@ -27,13 +27,6 @@ common base     default-language: Haskell2010     ghc-options: -Wall--    default-extensions:-        NoImplicitPrelude-        QuasiQuotes-        TemplateHaskell-        ViewPatterns-     build-depends:         ascii-char ^>= 1.0       , ascii-superset ^>= 1.0.1@@ -42,10 +35,9 @@ library     import: base     hs-source-dirs: library-+    default-extensions: NoImplicitPrelude TemplateHaskell ViewPatterns     build-depends:         template-haskell ^>= 2.16 || ^>= 2.17 || ^>= 2.18 || ^>= 2.19-     exposed-modules:         ASCII.TemplateHaskell       , ASCII.QuasiQuoters@@ -56,12 +48,10 @@     ghc-options: -fno-warn-overlapping-patterns     hs-source-dirs: test     main-is: Main.hs--    default-extensions:-        OverloadedStrings-+    default-extensions: NoImplicitPrelude OverloadedStrings QuasiQuotes+        TemplateHaskell TypeApplications ViewPatterns     build-depends:         ascii-th       , bytestring ^>= 0.10.12 || ^>= 0.11-      , hedgehog ^>= 1.0.5 || ^>= 1.1 || ^>= 1.2+      , hspec ^>= 2.8.5 || ^>= 2.9 || ^>= 2.10       , text ^>= 1.2.4 || ^>= 2.0
changelog.md view
@@ -1,3 +1,7 @@+### 1.0.0.14 (2023-01-02)++Change test suite from `hedgehog` to `hspec`+ ### 1.0.0.13 (2023-01-02)  Minor Cabal correction (change `extra-doc-files` to `extra-source-files`)
test/Main.hs view
@@ -6,104 +6,78 @@  import ASCII.Char (Char (..)) import ASCII.Refinement (ASCII, asciiUnsafe)-import ASCII.Superset (toCharOrFail) -import Control.Monad (Monad (..), when)-import Data.Bool (not) import Data.Function (($)) import Data.String (String) import Data.Text (Text) import Data.Word (Word8) import Prelude (Integer)-import System.Exit (exitFailure) import System.IO (IO)  import qualified Data.ByteString.Builder as BS.Builder+import qualified Data.ByteString.Lazy as LBS -import Hedgehog (Property, checkParallel, discover, property, withTests, (===))+import Test.Hspec (hspec, describe, it, shouldBe)  main :: IO ()-main = checkParallel $$(discover) >>= \ok -> when (not ok) exitFailure--prop_smallE :: Property-prop_smallE = withTests 1 $ property $-    ([char|e|] :: Char) === SmallLetterE--prop_smallE_word8 :: Property-prop_smallE_word8 = withTests 1 $ property $-    ([char|e|] :: Word8) === 101--prop_tilde_pattern :: Property-prop_tilde_pattern = withTests 1 $ property $-    2 === case Tilde of-        [char|@|] -> 1 :: Integer-        [char|~|] -> 2-        _ -> 3--prop_hello_list :: Property-prop_hello_list = withTests 1 $ property $-    ([string|Hello!|] :: [Char]) === [CapitalLetterH, SmallLetterE, SmallLetterL, SmallLetterL, SmallLetterO, ExclamationMark]--prop_hello_string :: Property-prop_hello_string = withTests 1 $ property $-    ([string|Hello!|] :: String) === "Hello!"--prop_hello_text :: Property-prop_hello_text = withTests 1 $ property $-    ([string|Hello!|] :: Text) === "Hello!"--prop_string_qq_expression :: Property-prop_string_qq_expression = withTests 1 $ property $-    BS.Builder.toLazyByteString [string|Hello!|] === "Hello!"--prop_string_qq_pattern :: Property-prop_string_qq_pattern = withTests 1 $ property $-    2 === case [CapitalLetterH, SmallLetterI] of-        [string|Bye|] -> 1 :: Integer-        [string|Hi|] -> 2-        _ -> 3--prop_char_splice_letter :: Property-prop_char_splice_letter = withTests 1 $ property $-    $(toCharOrFail 'F' >>= charExp) === CapitalLetterF+main = hspec $ do -prop_char_splice_del :: Property-prop_char_splice_del = withTests 1 $ property $-    $(toCharOrFail '\DEL' >>= charExp) === Delete+    describe "char quasi-quoter" $ do+        it "can be ASCII.Char" $ shouldBe @Char [char|e|] SmallLetterE+        it "can be Word8" $ shouldBe @Word8 [char|e|] 101+        it "can be a pattern" $ do+            let x = case Tilde of [char|@|] -> 1; [char|~|] -> 2; _ -> 3+            shouldBe @Integer x 2 -prop_char_splice_pattern :: Property-prop_char_splice_pattern = withTests 1 $ property $-    2 === case SmallLetterS of-        $(toCharOrFail 'r' >>= charPat) -> 1 :: Integer-        $(toCharOrFail 's' >>= charPat) -> 2-        _ -> 3+    describe "string quasi-quoter" $ do+        it "can be [ASCII.Char]" $ shouldBe @[Char] [string|Hello!|]+            [CapitalLetterH, SmallLetterE, SmallLetterL,+             SmallLetterL, SmallLetterO, ExclamationMark]+        it "can be String" $ shouldBe @String [string|Hello!|] "Hello!"+        it "can be Text" $ shouldBe @Text [string|Hello!|] "Hello!"+        it "can be bytestring Builder" $ shouldBe @LBS.ByteString+            (BS.Builder.toLazyByteString [string|Hello!|]) "Hello!"+        it "can be a pattern" $ do+            let x = case [CapitalLetterH, SmallLetterI] of+                      [string|Bye|] -> 1; [string|Hi|] -> 2; _ -> 3+            shouldBe @Integer x 2 -prop_char_list_splice :: Property-prop_char_list_splice = withTests 1 $ property $-    $(charListExp [CapitalLetterH, SmallLetterI]) === [CapitalLetterH, SmallLetterI]+    describe "charExp" $+        it "is a Char expression" $+            shouldBe @Char $(charExp CapitalLetterF) CapitalLetterF -prop_char_list_splice_pattern :: Property-prop_char_list_splice_pattern = withTests 1 $ property $-    2 === case [CapitalLetterH, SmallLetterI] of-        $(charListPat [CapitalLetterH, SmallLetterA]) -> 1 :: Integer-        $(charListPat [CapitalLetterH, SmallLetterI]) -> 2-        _ -> 3+    describe "charPat" $ do+        it "is a Char pattern" $ do+            let x = case SmallLetterS of $(charPat SmallLetterR) -> 1;+                                         $(charPat SmallLetterS) -> 2;+                                         _ -> 3+            shouldBe @Integer x 2 -prop_polymorphic_char_splice :: Property-prop_polymorphic_char_splice = withTests 1 $ property $-    ($(isCharExp CapitalLetterA) :: Char) === CapitalLetterA+    describe "charListExp" $ do+        it "is a [Char] expression" $ shouldBe @[Char]+            $(charListExp [CapitalLetterH, SmallLetterI])+            [CapitalLetterH, SmallLetterI] -prop_polymorphic_char_splice_word8 :: Property-prop_polymorphic_char_splice_word8 = withTests 1 $ property $-    ($(isCharExp CapitalLetterA) :: Word8) === 65+    describe "charListPat" $ do+        it "is a [Char] pattern" $ do+            let x = case [CapitalLetterH, SmallLetterI] of+                      $(charListPat [CapitalLetterH, SmallLetterA]) -> 1+                      $(charListPat [CapitalLetterH, SmallLetterI]) -> 2+                      _ -> 3+            shouldBe @Integer x 2 -prop_polymorphic_char_splice_ascii_word8 :: Property-prop_polymorphic_char_splice_ascii_word8 = withTests 1 $ property $-    ($(isCharExp CapitalLetterA) :: ASCII Word8) === asciiUnsafe 65+    describe "isCharExp" $ do+        it "can be ASCII.Char expression" $+            shouldBe @Char $(isCharExp CapitalLetterA) CapitalLetterA+        it "can be a Word8 expression" $+            shouldBe @Word8 $(isCharExp CapitalLetterA) 65+        it "can be an ASCII Word8 expression" $+            shouldBe @(ASCII Word8)+                $(isCharExp CapitalLetterA) (asciiUnsafe 65) -prop_polymorphic_char_splice_pattern :: Property-prop_polymorphic_char_splice_pattern = withTests 1 $ property $-    2 === case (66 :: Word8) of-        $(isCharPat CapitalLetterA) -> 1 :: Integer-        $(isCharPat CapitalLetterB) -> 2-        _ -> 3+    describe "isCharPat" $ do+        it "can be a Word8 pattern" $ do+            let x = case (66 :: Word8) of $(isCharPat CapitalLetterA) -> 1+                                          $(isCharPat CapitalLetterB) -> 2+                                          _ -> 3+            shouldBe @Word8 x 2