packages feed

git-config 0.1.1 → 0.1.2

raw patch · 3 files changed

+25/−14 lines, 3 filesdep ~megaparsecPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: megaparsec

API changes (from Hackage documentation)

- Text.GitConfig.Parser: Section :: [Text] -> (HashMap Text Text) -> Section
+ Text.GitConfig.Parser: Section :: [Text] -> HashMap Text Text -> Section

Files

git-config.cabal view
@@ -1,11 +1,13 @@--- This file has been generated from package.yaml by hpack version 0.20.0.+cabal-version: 1.12++-- This file has been generated from package.yaml by hpack version 0.31.2. -- -- see: https://github.com/sol/hpack ----- hash: 0aca7139a8c14002852a9afd277d50d4d9a76b6740a53a8bff57f37d8d70c611+-- hash: 0f49020a8cdb5c1fe3c4e47e6cb7ac3faa25db36208c7e09265b20c9769c645b  name:           git-config-version:        0.1.1+version:        0.1.2 synopsis:       A simple parser for Git configuration files description:    git-config is a simple 'megaparsec' parser for Git configuration files.                 .@@ -32,8 +34,6 @@ license:        BSD3 license-file:   LICENSE build-type:     Simple-cabal-version:  >= 1.10- extra-source-files:     README.md @@ -48,7 +48,7 @@   ghc-options: -Wall -fno-warn-partial-type-signatures -fno-warn-name-shadowing -fwarn-tabs -fwarn-unused-imports -fwarn-missing-signatures -fwarn-incomplete-patterns   build-depends:       base >=4.7 && <5-    , megaparsec+    , megaparsec >=7 && <9     , text     , unordered-containers   exposed-modules:@@ -64,6 +64,8 @@       test   default-extensions: OverloadedStrings   ghc-options: -Wall -fno-warn-partial-type-signatures -fno-warn-name-shadowing -fwarn-tabs -fwarn-unused-imports -fwarn-missing-signatures -fwarn-incomplete-patterns -threaded -rtsopts -with-rtsopts=-N+  build-tool-depends:+      tasty-discover:tasty-discover >=4.2.1 && <4.3   build-depends:       base >=4.7 && <5     , git-config
src/Text/GitConfig/Parser.hs view
@@ -50,15 +50,15 @@ import           Data.Text                  (Text) import qualified Data.Text                  as T import           Data.Void                  (Void)-import           Text.Megaparsec            (ParseError, Parsec, Token, between,-                                             eof, many, parse, sepBy, some,+import           Text.Megaparsec            (ParseErrorBundle, Parsec, between,+                                             eof, many, parse, satisfy, sepBy, some,                                              (<?>), (<|>)) import           Text.Megaparsec.Char       (alphaNumChar, char, eol,-                                             letterChar, printChar, satisfy,+                                             letterChar, printChar,                                              space1) import qualified Text.Megaparsec.Char.Lexer as Lexer -type GitConfigError = ParseError (Token Text) Void+type GitConfigError = ParseErrorBundle Text Void type Parser = Parsec Void Text  data Section = Section [Text] (HashMap Text Text)@@ -153,8 +153,9 @@ mapping :: Parser (Text, Text) mapping = do   varName <- variableName-  void (symbol "=")-  varValue <- variableValue+  varValue <- do void (symbol "=")+                 variableValue <|> pure ""+              <|> pure "true"   return (varName, varValue)  -- | Parse a complete git config section.
test/Text/GitConfig/ParserTest.hs view
@@ -110,8 +110,16 @@     [       testCase "valid" $         assertSuccess $ parse P.mapping "" "key = value\n",-      testCase "temporarily invalid boolean switch" $-        assertFail $ parse P.mapping "" "key\n"+      testCase "empty '= value' equals boolean true" $+        case parse P.mapping "" "key\n" of+          Left _ -> assertFailure ""+          Right (_,v) ->+            assertEqual "" "true" v+      , testCase "empty value equals empty string" $+          case parse P.mapping "" "key = \n" of+            Left _ -> assertFailure ""+            Right (_,v) ->+              assertEqual "" "" v     ]  test_section :: TestTree