Elm Exactly
Results / elm-json /

RoundTripObjectTest

elm-0.19.1 passelm-0.19.2 passelm-0.19.3 passlamdera-1.5.0 pass
`Json.Decode.field "name"` reads the string "tom" from an object built with `Json.Encode.object`.

Results

elm-0.19.1

passran in 46 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets.
rt_object: Ok "tom"

elm-0.19.2

passran in 58 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets.
rt_object: Ok "tom"

elm-0.19.3

passran in 48 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets.
rt_object: Ok "tom"

lamdera-1.5.0

passran in 44 ms
Output
rt_object: Ok "tom"

Discussions

Discuss this test·Search the discussions on GitHub

Discussions are on GitHub; one about this test has [t:elm-json/RoundTripObjectTest] in its title.

Source

The -- CHECK: lines give the expected output.

module RoundTripObjectTest exposing (main)
{-| `Json.Decode.field "name"` reads the string "tom" from an object built with `Json.Encode.object`.
-}
-- CHECK: rt_object: Ok "tom"
import Html exposing (text)
import Json.Decode as Decode
import Json.Encode as Encode
main =
let
json = Encode.encode 0 (Encode.object [ ( "name", Encode.string "tom" ) ])
_ = Debug.log "rt_object" (Decode.decodeString (Decode.field "name" Decode.string) json)
in
text "done"