cabal-gild 1.7.0.1 → 1.7.0.2
raw patch · 3 files changed
+30/−2 lines, 3 filesPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
API changes (from Hackage documentation)
+ CabalGild.Unstable.Action.FormatFields: joinSectionArgs :: [ByteString] -> ByteString
Files
- cabal-gild.cabal +1/−1
- source/library/CabalGild/Unstable/Action/FormatFields.hs +19/−1
- source/test-suite/Main.hs +10/−0
cabal-gild.cabal view
@@ -11,7 +11,7 @@ maintainer: Taylor Fausak name: cabal-gild synopsis: Formats package descriptions.-version: 1.7.0.1+version: 1.7.0.2 source-repository head type: git
source/library/CabalGild/Unstable/Action/FormatFields.hs view
@@ -16,6 +16,7 @@ import qualified CabalGild.Unstable.Type.TestedWith as TestedWith import qualified CabalGild.Unstable.Type.Variable as Variable import qualified Data.ByteString as ByteString+import qualified Data.Function as Function import qualified Data.Functor.Identity as Identity import qualified Data.Map as Map import qualified Data.Maybe as Maybe@@ -60,7 +61,7 @@ let result = Parsec.runParsecParser' csv (Condition.parseCondition Variable.parseVariable) "<conditional>" . FieldLineStream.fieldLineStreamFromBS- . ByteString.intercalate (ByteString.singleton 0x20)+ . joinSectionArgs $ fmap SectionArg.value sas position = fst@@ -78,6 +79,23 @@ $ Condition.prettyCondition Variable.prettyVariable c else sas in Fields.Section n newSas $ fmap (field csv) fs++-- | Joins section argument values with spaces, but concatenates a @*@ wildcard+-- directly onto a preceding token that ends with @.@ to preserve version+-- wildcards like @9.10.*@.+joinSectionArgs :: [ByteString.ByteString] -> ByteString.ByteString+joinSectionArgs =+ let space = ByteString.singleton 0x20+ asterisk = ByteString.singleton 0x2a+ fullStop = ByteString.singleton 0x2e+ merge = Function.fix $ \rec xs -> case xs of+ x : y : ys+ | ByteString.isSuffixOf fullStop x,+ y == asterisk ->+ (x <> y) : rec ys+ | otherwise -> x : rec (y : ys)+ _ -> xs+ in ByteString.intercalate space . merge -- | Returns 'True' if the field name is a conditional. @if@ is always one, and -- @elif@ is one for Cabal versions 2.2 and later.
source/test-suite/Main.hs view
@@ -765,6 +765,16 @@ "if impl ( ghc > 8 && < 9 )" "if impl(ghc >8 && <9)\n" + Hspec.it "formats impl with wildcard version" $ do+ expectGilded+ "if impl ( ghc == 9.10. * )"+ "if impl(ghc ==9.10.*)\n"++ Hspec.it "formats complex condition with wildcard version" $ do+ expectGilded+ "if ( ! flag ( hlint ) ) || ( impl ( ghc == 9.10. * ) || impl ( ghc >= 9.14 ) )"+ "if (!flag(hlint)) || (impl(ghc ==9.10.*) || impl(ghc >=9.14))\n"+ Hspec.it "formats os" $ do expectGilded "if os ( osx )"