hsini 0.3.1 → 0.4.0
raw patch · 8 files changed
+53/−43 lines, 8 filesdep +tastydep +tasty-hunitdep +tasty-quickcheckdep −test-frameworkdep −test-framework-hunitdep −test-framework-quickcheck2dep ~basedep ~mtl
Dependencies added: tasty, tasty-hunit, tasty-quickcheck, tasty-th
Dependencies removed: test-framework, test-framework-hunit, test-framework-quickcheck2, test-framework-th
Dependency ranges changed: base, mtl
Files
- hsini.cabal +7/−7
- src/Data/Ini.hs +1/−1
- src/Data/Ini/Reader.hs +1/−1
- src/Data/Ini/Reader/Internals.hs +5/−8
- src/Data/Ini/Types.hs +1/−1
- tst/Ini.hs +8/−7
- tst/Main.hs +7/−6
- tst/ReaderI.hs +23/−12
hsini.cabal view
@@ -1,5 +1,5 @@ name : hsini-version : 0.3.1+version : 0.4.0 license : BSD3 license-file : LICENSE author : Magnus Therning@@ -18,8 +18,8 @@ library hs-source-dirs : src default-language : Haskell2010- build-depends : base >=4.2 && <4.8, bytestring >=0.9 && <0.11,- containers >=0.3 && <0.6, mtl >=2.0 && <2.2, parsec ==3.1.*+ build-depends : base >=4.2 && <4.9, bytestring >=0.9 && <0.11,+ containers >=0.3 && <0.6, mtl >=2.0 && <2.3, parsec ==3.1.* exposed-modules : Data.Ini Data.Ini.Types Data.Ini.Reader other-modules : Data.Ini.Reader.Internals @@ -36,8 +36,8 @@ parsec, mtl, HUnit,- test-framework,- test-framework-hunit,- test-framework-quickcheck2,- test-framework-th,+ tasty,+ tasty-hunit,+ tasty-quickcheck,+ tasty-th, QuickCheck
src/Data/Ini.hs view
@@ -1,6 +1,6 @@ -- | -- Module : Data.Ini--- Copyright : 2011 Magnus Therning+-- Copyright : 2011-2014 Magnus Therning -- License : BSD3 -- -- A representation of configuration options. It consists of /sections/,
src/Data/Ini/Reader.hs view
@@ -1,6 +1,6 @@ -- | -- Module : Data.Ini.Reader--- Copyright : 2011 Magnus Therning+-- Copyright : 2011-2014 Magnus Therning -- License : BSD3 -- -- Parser for configurations.
src/Data/Ini/Reader/Internals.hs view
@@ -1,6 +1,6 @@ -- | -- Module : Data.Ini.Reader.Internals--- Copyright : 2011 Magnus Therning+-- Copyright : 2011-2014 Magnus Therning -- License : BSD3 -- -- Internal functions used in 'Data.Ini.Reader'.@@ -9,9 +9,9 @@ import Control.Monad.Error import Control.Monad.State -- import Text.ParserCombinators.Parsec as P+import qualified Data.ByteString as BS import Text.Parsec as P import Text.Parsec.String-import qualified Data.ByteString as BS import Data.Ini import Data.Ini.Types@@ -71,7 +71,7 @@ -- surrounded by any number of white space characters (see 'eatWhiteSpace'). secParser :: Parser IniFile secParser = let- validSecNameChrs = ['a'..'z'] ++ ['A'..'Z'] ++ ['0'..'9'] ++ "_-/@"+ validSecNameChrs = ['a'..'z'] ++ ['A'..'Z'] ++ ['0'..'9'] ++ "._-/@\" " in do char '[' eatWhiteSpace@@ -120,8 +120,5 @@ in choice [commentP, emptyL] >> return CommentL iniParser :: Parser [IniFile]-iniParser = do- many noiseParser- s1 <- secParser- r <- many $ choice [secParser, optLineParser, optContParser, noiseParser]- return (s1:r)+iniParser =+ many $ choice [secParser, optLineParser, optContParser, noiseParser]
src/Data/Ini/Types.hs view
@@ -1,6 +1,6 @@ -- | -- Module : Data.Ini.Types--- Copyright : 2011 Magnus Therning+-- Copyright : 2011-2014 Magnus Therning -- License : BSD3 module Data.Ini.Types where
tst/Ini.hs view
@@ -1,15 +1,15 @@ {-# OPTIONS_GHC -XTemplateHaskell #-}--- Copyright : 2011 Magnus Therning+-- Copyright : 2011-2014 Magnus Therning -- License : BSD3-module Ini where+module Ini+ ( allTests+ ) where -- {{{1 imports-import Data.List import Data.Maybe-import Test.Framework-import Test.Framework.TH-import Test.Framework.Providers.QuickCheck2-import Test.QuickCheck+import Test.Tasty+import Test.Tasty.QuickCheck+import Test.Tasty.TH import Data.Ini import Data.Ini.Types@@ -68,4 +68,5 @@ lstItems = fromJust $ lookup sn _cfglst -- {{{1 allTests+allTests :: TestTree allTests = $(testGroupGenerator)
tst/Main.hs view
@@ -1,13 +1,14 @@--- Copyright : 2011 Magnus Therning+-- Copyright : 2011-2014 Magnus Therning -- License : BSD3 module Main where -import Test.Framework+import Test.Tasty import qualified Ini as I import qualified ReaderI as RI -main = defaultMain- [ I.allTests- , RI.allTests- ]+main :: IO ()+main = defaultMain allTests++allTests :: TestTree+allTests = testGroup "All tests" [I.allTests, RI.allTests]
tst/ReaderI.hs view
@@ -1,12 +1,13 @@ {-# OPTIONS_GHC -XTemplateHaskell #-}--- Copyright : 2011 Magnus Therning+-- Copyright : 2011-2014 Magnus Therning -- License : BSD3-module ReaderI where+module ReaderI+ (allTests+ ) where -import Test.Framework-import Test.Framework.Providers.HUnit-import Test.Framework.TH-import Test.HUnit.Base+import Test.Tasty+import Test.Tasty.HUnit+import Test.Tasty.TH import Text.ParserCombinators.Parsec as P import Data.Ini.Reader.Internals@@ -45,11 +46,6 @@ actual = p2E secParser "sec" "[_foo]\n" in expected @=? actual -case_secParserDisallowedChars1 = let- expected = Left "bad"- actual = p2E secParser "sec" "[foo.bar]\n"- in expected @=? actual- case_secParserDropSpace = let expected = Right $ SectionL "foo" actual = p2E secParser "sec" "[ \tfoo\t ]\n"@@ -60,6 +56,16 @@ actual = p2E secParser "sec" "[foo] \t foobar\n" in expected @=? actual +case_secParserAllowGit1 = let+ expected = Right $ SectionL "branch \"master\""+ actual = p2E secParser "sec" "[branch \"master\"]\n"+ in expected @=? actual++case_secParserAllowGit2 = let+ expected = Right $ SectionL "foo \"bar.baz\""+ actual = p2E secParser "sec" "[foo \"bar.baz\"]\n"+ in expected @=? actual+ -- {{{1 optLineParser case_optLineParserAllowedChars1 = let expected = Right $ OptionL "foo" "bar"@@ -139,9 +145,14 @@ in expected @=? actual -- {{{1 iniParser--- TBD+case_iniParserEmpty :: Assertion+case_iniParserEmpty = expected @=? actual+ where+ expected = Right []+ actual = p2E iniParser "parsing empty file" "" -- {{{1 buildConfig -- TBD +allTests :: TestTree allTests = $(testGroupGenerator)