Skip to content

Commit f560f3a

Browse files
committed
Add test for decodeNewlineDelimited
1 parent 2ec0de0 commit f560f3a

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/Json.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ newline-delimited JSON is somewhat common in practice. It's nice to have
217217
this here instead of having to reimplement it in a bunch of different
218218
applications.
219219
220-
Note: To protect against malicious input, this reject byte sequences with
220+
Note: To protect against malicious input, this rejects byte sequences with
221221
more than 10 million newlines. If this is causing a problem for you, open
222222
an issue.
223223

test/Main.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,12 @@ tests = testGroup "Tests"
123123
@=?
124124
BChunks.concat (Builder.run 4 (J.encode (J.String "It\2019s over now")))
125125
]
126+
, testGroup "decodeNewlineDelimited"
127+
[ THU.testCase "no-trailing-newline" $
128+
Right (Exts.fromList [J.emptyObject, J.emptyObject])
129+
@=?
130+
J.decodeNewlineDelimited (shortTextToBytes "{}\n{}")
131+
]
126132
, testGroup "objectFromList"
127133
[ THU.testCase "empty object" $
128134
J.objectFromList []

0 commit comments

Comments
 (0)