Skip to content

Commit

Permalink
Add failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
jfmengels committed Aug 2, 2024
1 parent 6039934 commit 1b2124d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/Elm/Parser/FileTests.elm
Original file line number Diff line number Diff line change
Expand Up @@ -468,4 +468,17 @@ port sendResponse : String -> Cmd msg
, comments = [ Node { start = { row = 6, column = 1 }, end = { row = 7, column = 3 } } "{-| foo\n-}" ]
}
)
, test "A file with a large number of comments should not create a stack overflow" <|
\() ->
let
comments : String
comments =
String.repeat 3000 "-- a\n"
in
("""module Foo exposing (..)
a = 1
""" ++ comments)
|> Elm.Parser.parseToFile
|> Result.map (\ast -> List.length ast.comments)
|> Expect.equal (Ok 3000)
]

0 comments on commit 1b2124d

Please sign in to comment.