Fix ini-compat test and add lower version bound
Getty Ritter
4 years ago
59 | 59 |
hs-source-dirs: test/ini-compat
|
60 | 60 |
main-is: Main.hs
|
61 | 61 |
build-depends: base
|
62 | |
, ini
|
| 62 |
, ini >=4.0
|
63 | 63 |
, config-ini
|
64 | 64 |
, hedgehog
|
65 | 65 |
, containers
|
50 | 50 |
Right (toMaps raw) === fmap toMaps (I2.parseRawIni (I2.printRawIni raw))
|
51 | 51 |
|
52 | 52 |
lower :: I1.Ini -> HashMap Text (HashMap Text Text)
|
53 | |
lower (I1.Ini ini) = go (fmap go ini)
|
54 | |
where go hm = HM.fromList [ (T.toLower k, v) | (k, v) <- HM.toList hm ]
|
| 53 |
lower (I1.Ini sections _) = HM.fromList
|
| 54 |
[ (T.toLower sectionName, HM.fromList [ (T.toLower k, v) | (k, v) <- section ])
|
| 55 |
| (sectionName, section) <- HM.toList sections
|
| 56 |
]
|
55 | 57 |
|
56 | 58 |
toMaps :: I2.RawIni -> HashMap Text (HashMap Text Text)
|
57 | 59 |
toMaps (I2.RawIni m) = conv (fmap sectionToPair m)
|
|
70 | 72 |
name <- textChunk
|
71 | 73 |
section <- Gen.list (Range.linear 0 10) $
|
72 | 74 |
(,) <$> textChunk <*> textChunk
|
73 | |
return (name, HM.fromList section)
|
74 | |
return (I1.Ini (HM.fromList ss))
|
| 75 |
return (name, section)
|
| 76 |
return (I1.Ini (HM.fromList ss) [])
|
75 | 77 |
|
76 | 78 |
mkComments :: Gen (Seq.Seq I2.BlankLine)
|
77 | 79 |
mkComments = fmap Seq.fromList $ Gen.list (Range.linear 0 5) $
|