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