Skip to content

Commit

Permalink
Add test for decodeNewlineDelimited
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewthad committed Apr 25, 2024
1 parent 2ec0de0 commit f560f3a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Json.hs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ newline-delimited JSON is somewhat common in practice. It's nice to have
this here instead of having to reimplement it in a bunch of different
applications.
Note: To protect against malicious input, this reject byte sequences with
Note: To protect against malicious input, this rejects byte sequences with
more than 10 million newlines. If this is causing a problem for you, open
an issue.
Expand Down
6 changes: 6 additions & 0 deletions test/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ tests = testGroup "Tests"
@=?
BChunks.concat (Builder.run 4 (J.encode (J.String "It\2019s over now")))
]
, testGroup "decodeNewlineDelimited"
[ THU.testCase "no-trailing-newline" $
Right (Exts.fromList [J.emptyObject, J.emptyObject])
@=?
J.decodeNewlineDelimited (shortTextToBytes "{}\n{}")
]
, testGroup "objectFromList"
[ THU.testCase "empty object" $
J.objectFromList []
Expand Down

0 comments on commit f560f3a

Please sign in to comment.