language-docker 10.4.0 → 10.4.1
raw patch · 3 files changed
+50/−4 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- language-docker.cabal +2/−2
- src/Language/Docker/Parser/Prelude.hs +3/−2
- test/Language/Docker/ParseRunSpec.hs +45/−0
language-docker.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 309a0c933f6e5edbdfbe096391f0b79e6a6f9218347d912f390d58a9c7c7c475+-- hash: a57fde3be580edb76aab82767e9e47bbe3cb585d5ea2af07eeb05b5331a5bac8 name: language-docker-version: 10.4.0+version: 10.4.1 synopsis: Dockerfile parser, pretty-printer and embedded DSL description: All functions for parsing and pretty-printing Dockerfiles are exported through @Language.Docker@. For more fine-grained operations look for specific modules that implement a certain functionality. See the <https://github.com/hadolint/language-docker GitHub project> for the source-code and examples.
src/Language/Docker/Parser/Prelude.hs view
@@ -209,10 +209,11 @@ m <- heredocMarker heredocContent m --- | Parses text until a heredoc is found. Will also consume the heredoc.+-- | Parses text until a heredoc or newline is found. Will also consume the+-- heredoc. untilHeredoc :: Parser Text untilHeredoc = do- txt <- manyTill anySingle heredoc+ txt <- manyTill (anySingleBut '\n') heredoc return $ T.strip $ T.pack txt onlySpaces :: Parser Text
test/Language/Docker/ParseRunSpec.hs view
@@ -6,6 +6,7 @@ import Test.HUnit hiding (Label) import Test.Hspec import TestHelper+import qualified Data.List.NonEmpty as NonEmpty import qualified Data.Set as Set import qualified Data.Text as Text @@ -532,3 +533,47 @@ let file = "RUN <<EOF\necho $EOF\nEOF" flags = def {security = Nothing } in assertAst file [ Run $ RunArgs (ArgumentsText "echo $EOF") flags ]++ -- This one is neccessary to make sure that we can both parse+ -- RUN something <<EOF+ -- bla+ -- EOF+ --+ -- and not overshoot while parsing that `something` and accidentally parse+ -- some docker instructions as well.+ it "heredoc no overzealous parsing" $+ let file =+ Text.unlines+ [ "RUN foo bar",+ "FROM something",+ "COPY <<EOF /foobar.sh",+ "#!/bin/bash",+ "echo foobar",+ "EOF"+ ]+ flags = def+ in assertAst+ file+ [ Run $ RunArgs (ArgumentsText "foo bar") flags,+ From+ ( BaseImage+ { image =+ Image+ { registryName = Nothing,+ imageName = "something"+ },+ tag = Nothing,+ digest = Nothing,+ alias = Nothing,+ platform = Nothing+ }+ ),+ Copy+ ( CopyArgs+ [ SourcePath "EOF" ]+ (TargetPath "/foobar.sh")+ NoChown+ NoChmod+ NoSource+ )+ ]