packages feed

language-docker 10.0.1 → 10.0.2

raw patch · 4 files changed

+15/−6 lines, 4 filesdep +hspec-megaparsec

Dependencies added: hspec-megaparsec

Files

language-docker.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: be22c1fce0b44e319fb3f3074bc1842d248590c1834772b7b85f184f88634f45+-- hash: 0acabc7fcd899e8d19189dd6a3e3541b451fb5e35c3ed9751f8f0261404d8197  name:           language-docker-version:        10.0.1+version:        10.0.2 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.@@ -101,6 +101,7 @@     , containers     , data-default-class     , hspec+    , hspec-megaparsec     , language-docker     , megaparsec >=8.0     , prettyprinter
src/Language/Docker/Parser/Expose.hs view
@@ -13,11 +13,10 @@   Expose <$> ports  port :: (?esc :: Char) => Parser Port-port =-  (try portVariable <?> "a variable")+port = (try portVariable <?> "a variable")     <|> (try portRange <?> "a port range optionally followed by the protocol (udp/tcp)") -- There a many valid representations of ports     <|> (try portWithProtocol <?> "a port with its protocol (udp/tcp)")-    <|> (try portInt <?> "a valid port number")+    <|> (portInt <?> "a valid port number")  ports :: (?esc :: Char) => Parser Ports ports = Ports <$> port `sepEndBy` requiredWhitespace@@ -33,7 +32,7 @@ protocol :: Parser Protocol protocol = do   void (char '/')-  tcp <|> udp+  try (tcp <|> udp) <|> fail "invalid protocol"   where     tcp = caseInsensitiveString "tcp" >> return TCP     udp = caseInsensitiveString "udp" >> return UDP
test/Language/Docker/ParserSpec.hs view
@@ -357,6 +357,9 @@                     ]                 )             ]+    it "should fail with wrong protocol" $+      let content = "EXPOSE 80/ip"+       in expectFail content   describe "syntax" $ do     it "should handle lowercase instructions (#7 - https://github.com/beijaflor-io/haskell-language-dockerfile/issues/7)" $       let content = "from ubuntu"
test/TestHelper.hs view
@@ -1,5 +1,6 @@ module TestHelper   ( assertAst,+    expectFail,     taggedImage,     withAlias,     withDigest,@@ -13,6 +14,7 @@ import Language.Docker.Syntax import Test.HUnit hiding (Label) import Test.Hspec+import Test.Hspec.Megaparsec import Text.Megaparsec hiding (Label)  @@ -36,3 +38,7 @@   case parseText s of     Left err -> assertFailure $ errorBundlePretty err     Right dockerfile -> assertEqual "ASTs are not equal" ast $ map instruction dockerfile++expectFail :: HasCallStack => Text.Text -> Assertion+expectFail input =+  parseText `shouldFailOn` input