Skip to content

Commit

Permalink
Merge pull request #18 from nicholassaunders/bug/parse-same-line-comm…
Browse files Browse the repository at this point in the history
…ents

Fix parsing same-line comments; resolves #17.
  • Loading branch information
nsaunders authored May 31, 2019
2 parents 5853d0b + 7ddc8ab commit ff1925d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Dotenv/Internal/Parse.purs
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@ value = (quotedValue '"' <|> quotedValue '\'' <|> unquotedValue) <?> "variable v

-- | Parses a setting in the form of `NAME=value`.
setting :: Parser String Setting
setting = Tuple <$> name <*> value
setting = Tuple <$> name <*> value <* many (noneOf newlineChars)
4 changes: 2 additions & 2 deletions test/Parse.purs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ tests = describe "settings parser" do

it "skips comments on the same line after a setting" $
let
expected = Right [ Tuple "A" $ LiteralValue "B", Tuple "C" $ LiteralValue "D" ]
actual = "A=B\nC=D # Testing" `runParser` settings
expected = Right [ Tuple "A" $ LiteralValue "B", Tuple "C" $ LiteralValue "D", Tuple "E" $ LiteralValue "F" ]
actual = "A=B\nC=D # Testing\nE=F" `runParser` settings
in
actual `shouldEqual` expected

Expand Down

0 comments on commit ff1925d

Please sign in to comment.