tomland 1.3.2.0 → 1.3.3.0
raw patch · 10 files changed
+34/−33 lines, 10 filesdep −hspec-goldendep ~basedep ~hashabledep ~validation-selective
Dependencies removed: hspec-golden
Dependency ranges changed: base, hashable, validation-selective
Files
- CHANGELOG.md +8/−0
- src/Toml/Type/Printer.hs +3/−2
- test/Test/Toml/Type/Printer.hs +4/−6
- test/golden/pretty_custom_sorted.golden +1/−2
- test/golden/pretty_default.golden +1/−2
- test/golden/pretty_indented_only.golden +4/−5
- test/golden/pretty_lines.golden +3/−4
- test/golden/pretty_sorted_only.golden +1/−2
- test/golden/pretty_unformatted.golden +4/−5
- tomland.cabal +5/−5
CHANGELOG.md view
@@ -3,6 +3,14 @@ `tomland` uses [PVP Versioning][1]. The changelog is available [on GitHub][2]. +## 🥞 1.3.3.0 — Mar 14, 2021++* [#370](https://github.com/kowainik/tomland/issues/370):+ Support GHC-9.0.1.+* [#368](https://github.com/kowainik/tomland/issues/368):+ Upgrade `hashable` lower bound to 1.3.1.0.+* Sort keys in pretty printing by default.+ ## 🐂 1.3.2.0 — Feb 12, 2021 * [#186](https://github.com/kowainik/tomland/issues/186):
src/Toml/Type/Printer.hs view
@@ -22,6 +22,7 @@ , prettyKey ) where +import GHC.Exts (sortWith) import Data.Bifunctor (first) import Data.Char (isAscii, ord) import Data.Coerce (coerce)@@ -178,7 +179,7 @@ showText :: Show a => a -> Text showText = Text.pack . show - + -- | Function encodes all non-ascii characters in TOML defined form using the isAscii function showTextUnicode :: Text -> Text showTextUnicode text = Text.pack $ show finalText@@ -267,7 +268,7 @@ mapOrdered :: ((Key, v) -> [t]) -> PrintOptions -> [(Key, v)] -> [t] mapOrdered f options = case printOptionsSorting options of Just sorter -> concatMap f . sortBy (sorter `on` fst)- Nothing -> concatMap f+ Nothing -> concatMap f . sortWith fst -- Adds next part of the table name to the accumulator. addPrefix :: Key -> Text -> Text
test/Test/Toml/Type/Printer.hs view
@@ -6,8 +6,7 @@ import Data.List.NonEmpty (NonEmpty ((:|))) import Data.Ord (comparing)-import Test.Hspec (Arg, Expectation, Spec, SpecWith, describe, it)-import Test.Hspec.Golden (defaultGolden)+import Test.Hspec (Arg, Expectation, Spec, SpecWith, describe, it, shouldReturn) import Toml.Type.Edsl (empty, mkToml, table, tableArray, (=:)) import Toml.Type.Key (Key (..), (<|))@@ -15,7 +14,7 @@ import Toml.Type.TOML (TOML) import Toml.Type.Value (Value (..)) -import qualified Data.Text as T+import qualified Data.Text.IO as T printerSpec :: Spec@@ -29,9 +28,8 @@ where test :: String -> PrintOptions -> SpecWith (Arg Expectation) test name options = it ("Golden " ++ name) $- defaultGolden- ("test/golden/" ++ name ++ ".golden")- (T.unpack $ prettyOptions options example)+ T.readFile ("test/golden/" ++ name ++ ".golden")+ `shouldReturn` prettyOptions options example example :: TOML example = mkToml $ do
test/golden/pretty_custom_sorted.golden view
@@ -2,14 +2,13 @@ b = "bb" c = "cccc" d = "ddd"+list = ["one", "two"] [baz] [doo] [foo]--list = ["one", "two"] [qux.doo] spam = "!"
test/golden/pretty_default.golden view
@@ -2,10 +2,9 @@ b = "bb" c = "cccc" d = "ddd"+list = ["one", "two"] [baz]--list = ["one", "two"] [doo]
test/golden/pretty_indented_only.golden view
@@ -1,15 +1,14 @@ a = "a"+b = "bb" c = "cccc" d = "ddd"-b = "bb"+list = ["one", "two"] +[baz]+ [doo] [foo]--[baz]--list = ["one", "two"] [qux.doo] egg = "?"
test/golden/pretty_lines.golden view
@@ -2,13 +2,12 @@ b = "bb" c = "cccc" d = "ddd"--[baz]--list =+list = [ "one" , "two" ]++[baz] [doo]
test/golden/pretty_sorted_only.golden view
@@ -2,10 +2,9 @@ b = "bb" c = "cccc" d = "ddd"+list = ["one", "two"] [baz]--list = ["one", "two"] [doo]
test/golden/pretty_unformatted.golden view
@@ -1,15 +1,14 @@ a = "a"+b = "bb" c = "cccc" d = "ddd"-b = "bb"+list = ["one", "two"] +[baz]+ [doo] [foo]--[baz]--list = ["one", "two"] [qux.doo] egg = "?"
tomland.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: tomland-version: 1.3.2.0+version: 1.3.3.0 synopsis: Bidirectional TOML serialization description: Implementation of bidirectional TOML serialization. Simple codecs look like this:@@ -38,13 +38,14 @@ GHC == 8.6.5 GHC == 8.8.4 GHC == 8.10.4+ GHC == 9.0.1 source-repository head type: git location: https://github.com/kowainik/tomland.git common common-options- build-depends: base >= 4.11 && < 4.15+ build-depends: base >= 4.11 && < 4.16 ghc-options: -Wall -Wcompat@@ -118,7 +119,7 @@ build-depends: bytestring ^>= 0.10 , containers >= 0.5.7 && < 0.7 , deepseq ^>= 1.4- , hashable >= 1.2 && < 1.4+ , hashable >= 1.3.1.0 && < 1.4 , megaparsec >= 7.0.5 && < 9.1 , mtl ^>= 2.2 , parser-combinators >= 1.1.0 && < 1.4@@ -126,7 +127,7 @@ , time >= 1.8 && < 1.11 , transformers ^>= 0.5 , unordered-containers ^>= 0.2.7- , validation-selective ^>= 0.1.0.0+ , validation-selective ^>= 0.1.0 executable readme import: common-options@@ -214,7 +215,6 @@ , hedgehog ^>= 1.0.1 , hspec ^>= 2.7.1 , hspec-hedgehog ^>= 0.0.1- , hspec-golden ^>= 0.1.0 , hspec-megaparsec >= 2.0.0 && < 2.3.0 , megaparsec , directory ^>= 1.3