JsonEncodeBigStringTest
Checks that `Json.Encode.string` encodes a 5000-character string as a quoted JSON string. The string is built with `String.repeat`, and the length of the encoded text is printed: 5000 characters plus two quotes gives 5002.
Results
elm-0.19.1
passran in 58 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets. JsonEncodeBigStringTest: 5002
elm-0.19.2
passran in 54 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets. JsonEncodeBigStringTest: 5002
elm-0.19.3
passran in 76 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets. JsonEncodeBigStringTest: 5002
lamdera-1.5.0
passran in 43 msOutput
JsonEncodeBigStringTest: 5002
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm-json/JsonEncodeBigStringTest] in its title.
Source
The -- CHECK: lines give the expected output.
module JsonEncodeBigStringTest exposing (main)
{-| Checks that `Json.Encode.string` encodes a 5000-character string as a quoted JSON string.
The string is built with `String.repeat`, and the length of the encoded text is
printed: 5000 characters plus two quotes gives 5002.
-}
-- CHECK: JsonEncodeBigStringTest: 5002
import Html exposing (text)
import Json.Encode as E
main =
let
encoded =
E.encode 0 (E.string (String.repeat 5000 "x"))
_ =
Debug.log "JsonEncodeBigStringTest" (String.length encoded)
in
text "ok"