StringLengthTest
`String.length` returns 5 for `"Hello"`, 0 for the empty string, and 13 for `"Hello, World!"`.
Results
elm-0.19.1
passran in 53 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets. len1: 5 len2: 0 len3: 13
elm-0.19.2
passran in 49 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets. len1: 5 len2: 0 len3: 13
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. len1: 5 len2: 0 len3: 13
lamdera-1.5.0
passran in 39 msOutput
len1: 5 len2: 0 len3: 13
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm-core/StringLengthTest] in its title.
Source
The -- CHECK: lines give the expected output.
module StringLengthTest exposing (main)
{-| `String.length` returns 5 for `"Hello"`, 0 for the empty string, and 13 for
`"Hello, World!"`.
-}
-- CHECK: len1: 5
-- CHECK: len2: 0
-- CHECK: len3: 13
import Html exposing (text)
main =
let
_ = Debug.log "len1" (String.length "Hello")
_ = Debug.log "len2" (String.length "")
_ = Debug.log "len3" (String.length "Hello, World!")
in
text "done"