packages feed

comma-and 0.1.0.0 → 0.1.0.1

raw patch · 3 files changed

+53/−5 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

README.md view
@@ -16,6 +16,10 @@  The package has tooling for the two different comma styles, and can work with any *string-like* type. +## *String-like* types?++The package can work with types that are an instance of `IsString` and `Monoid`. So this means it works with `String`, `Text`, `ByteString`, `MarkupM`, and probably a lot more types that concatenate with the `Monoid` instance, and are an instance of `IsString`.+ ## `comma-and` is *safe* Haskell  The module is compiled with `Safe` and does not depend on unsafe modules.
comma-and.cabal view
@@ -1,5 +1,5 @@ name:                comma-and-version:             0.1.0.0+version:             0.1.0.1 synopsis: Join text together with commas, and "and". description: Convert a 'Text' object into a visually pleasant URL component. homepage:            https://github.com/hapytex/comma-and#readme@@ -7,7 +7,7 @@ license-file:        LICENSE author:              Willem Van Onsem maintainer:          hapytexeu+gh@gmail.com-copyright:           2020 Willem Van Onsem+copyright:           2024 Willem Van Onsem category:            utils build-type:          Simple extra-source-files:@@ -24,7 +24,7 @@     , data-default-class >=0.1 && <0.2   default-language:    Haskell2010 -test-suite gulsify+test-suite and   type:                exitcode-stdio-1.0   main-is:             Main.hs   hs-source-dirs:      test
test/Text/CommaSpec.hs view
@@ -1,12 +1,56 @@ module Text.CommaSpec where +import Data.Default.Class(Default(def))+ import Test.Hspec(Spec, describe, it, shouldBe)-import Text.Comma(comma)+import Text.Comma(CommaStyle(OxfordComma, NoComma), comma, commaAs, commaEmpty, commaEmptyAs, lastJoin, noComma, noCommaEmpty)  spec :: Spec-spec = describe "comma" $ do+spec = describe "and" $ do     it "comma" $ do       comma [] `shouldBe` ""       comma ["red"] `shouldBe` "red"       comma ["red", "green"] `shouldBe` "red, and green"       comma ["red", "green", "blue"] `shouldBe` "red, green, and blue"+    it "commaEmpty" $ do+      commaEmpty "and" [] `shouldBe` "and"+      commaEmpty "and" ["red"] `shouldBe` "red"+      commaEmpty "and" ["red", "green"] `shouldBe` "red, and green"+      commaEmpty "and" ["red", "green", "blue"] `shouldBe` "red, green, and blue"+    it "noComma" $ do+      noComma [] `shouldBe` ""+      noComma ["red"] `shouldBe` "red"+      noComma ["red", "green"] `shouldBe` "red and green"+      noComma ["red", "green", "blue"] `shouldBe` "red, green and blue"+    it "noCommaEmpty" $ do+      noCommaEmpty "and" [] `shouldBe` "and"+      noCommaEmpty "and" ["red"] `shouldBe` "red"+      noCommaEmpty "and" ["red", "green"] `shouldBe` "red and green"+      noCommaEmpty "and" ["red", "green", "blue"] `shouldBe` "red, green and blue"+    it "commaAs" $ do+      commaAs OxfordComma [] `shouldBe` ""+      commaAs OxfordComma ["red"] `shouldBe` "red"+      commaAs OxfordComma ["red", "green"] `shouldBe` "red, and green"+      commaAs OxfordComma ["red", "green", "blue"] `shouldBe` "red, green, and blue"+      commaAs NoComma [] `shouldBe` ""+      commaAs NoComma ["red"] `shouldBe` "red"+      commaAs NoComma ["red", "green"] `shouldBe` "red and green"+      commaAs NoComma ["red", "green", "blue"] `shouldBe` "red, green and blue"+    it "commaEmptyAs" $ do+      commaEmptyAs "and" OxfordComma [] `shouldBe` "and"+      commaEmptyAs "and" OxfordComma ["red"] `shouldBe` "red"+      commaEmptyAs "and" OxfordComma ["red", "green"] `shouldBe` "red, and green"+      commaEmptyAs "and" OxfordComma ["red", "green", "blue"] `shouldBe` "red, green, and blue"+      commaEmptyAs "and" NoComma [] `shouldBe` "and"+      commaEmptyAs "and" NoComma ["red"] `shouldBe` "red"+      commaEmptyAs "and" NoComma ["red", "green"] `shouldBe` "red and green"+      commaEmptyAs "and" NoComma ["red", "green", "blue"] `shouldBe` "red, green and blue"+    it "lastJoin" $ do+      lastJoin OxfordComma `shouldBe` ", and "+      lastJoin NoComma `shouldBe` " and "+    it "CommaStyle" $ do+      def `shouldBe` OxfordComma+      minBound `shouldBe` OxfordComma+      maxBound `shouldBe` NoComma+      succ OxfordComma `shouldBe` NoComma+      compare OxfordComma NoComma `shouldBe` LT