File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -127,6 +127,7 @@ emptyObjectValue :: Value
127127emptyObjectValue = Object ChunksNil
128128
129129isSpace :: Word8 -> Prelude. Bool
130+ {-# inline isSpace #-}
130131isSpace w =
131132 w == c2w ' '
132133 || w == c2w ' \t '
@@ -234,6 +235,7 @@ parser = \case
234235 _ -> P. fail InvalidLeader
235236
236237objectTrailedByBrace :: Parser SyntaxException s Value
238+ {-# inline objectTrailedByBrace #-}
237239objectTrailedByBrace = do
238240 P. skipWhile isSpace
239241 Latin. any IncompleteObject >>= \ case
@@ -280,6 +282,7 @@ objectStep !b = do
280282--
281283-- This parser handles everything after the LBRACKET character.
282284arrayTrailedByBracket :: Parser SyntaxException s Value
285+ {-# inline arrayTrailedByBracket #-}
283286arrayTrailedByBracket = do
284287 P. skipWhile isSpace
285288 Latin. any IncompleteArray >>= \ case
Original file line number Diff line number Diff line change 44import Control.Monad (when )
55import Data.ByteString.Short.Internal (ShortByteString (SBS ))
66import Data.Bytes (Bytes )
7+ import Data.Chunks (Chunks (ChunksCons ,ChunksNil ))
78import Data.Primitive (ByteArray (ByteArray ))
89import Data.Scientific (Scientific ,scientific )
910import Data.Text.Short (ShortText )
@@ -62,6 +63,14 @@ tests = testGroup "Tests"
6263 , THU. testCase " H" $ case J. decode (shortTextToBytes " [] x" ) of
6364 Left _ -> pure ()
6465 Right _ -> fail " this was not supposed parse"
66+ , THU. testCase " I" $
67+ BChunks. concat (Builder. run 1 (J. encode (J. Array (ChunksCons mempty ChunksNil ))))
68+ @=?
69+ Bytes. fromLatinString " []"
70+ , THU. testCase " J" $
71+ BChunks. concat (Builder. run 1 (J. encode (J. Array ChunksNil )))
72+ @=?
73+ Bytes. fromLatinString " []"
6574 , THU. testCase " Twitter100" $
6675 case J. decode (Bytes. fromByteArray encodedTwitter100) of
6776 Left _ -> fail " nope"
You can’t perform that action at this time.
0 commit comments