RoundTripStringTest
The string "hello" encoded with `Json.Encode.string` decodes back to "hello" with `Json.Decode.string`.
Results
elm-0.19.1
passran in 41 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets. rt_string: Ok "hello"
elm-0.19.2
passran in 36 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets. rt_string: Ok "hello"
elm-0.19.3
passran in 37 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets. rt_string: Ok "hello"
lamdera-1.5.0
passran in 39 msOutput
rt_string: Ok "hello"
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm-json/RoundTripStringTest] in its title.
Source
The -- CHECK: lines give the expected output.
module RoundTripStringTest exposing (main)
{-| The string "hello" encoded with `Json.Encode.string` decodes back to "hello" with `Json.Decode.string`.
-}
-- CHECK: rt_string: Ok "hello"
import Html exposing (text)
import Json.Decode as Decode
import Json.Encode as Encode
main =
let
_ = Debug.log "rt_string" (Decode.decodeString Decode.string (Encode.encode 0 (Encode.string "hello")))
in
text "done"