JsArrayBasicsTest
`Array.toList`, `Array.length` and `Array.isEmpty` give the expected results on `Array.fromList [1, 2, 3]` and on `Array.empty`.
Results
elm-0.19.1
passran in 59 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets. toList: [1,2,3] length: 3 isEmpty_empty: True isEmpty_nonempty: False empty_toList: []
elm-0.19.2
passran in 76 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets. toList: [1,2,3] length: 3 isEmpty_empty: True isEmpty_nonempty: False empty_toList: []
elm-0.19.3
passran in 70 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets. toList: [1,2,3] length: 3 isEmpty_empty: True isEmpty_nonempty: False empty_toList: []
lamdera-1.5.0
passran in 86 msOutput
toList: [1,2,3] length: 3 isEmpty_empty: True isEmpty_nonempty: False empty_toList: []
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm-core/JsArrayBasicsTest] in its title.
Source
The -- CHECK: lines give the expected output.
module JsArrayBasicsTest exposing (main)
{-| `Array.toList`, `Array.length` and `Array.isEmpty` give the expected results on `Array.fromList [1, 2, 3]` and on `Array.empty`.
-}
-- CHECK: toList: [1,2,3]
-- CHECK: length: 3
-- CHECK: isEmpty_empty: True
-- CHECK: isEmpty_nonempty: False
-- CHECK: empty_toList: []
import Array
import Html exposing (text)
main =
let
arr = Array.fromList [1, 2, 3]
_ = Debug.log "toList" (Array.toList arr)
_ = Debug.log "length" (Array.length arr)
_ = Debug.log "isEmpty_empty" (Array.isEmpty Array.empty)
_ = Debug.log "isEmpty_nonempty" (Array.isEmpty arr)
_ = Debug.log "empty_toList" (Array.toList (Array.empty))
in
text "done"