StringMapFilterTest
Checks that `String.map` transforms every character and `String.filter` keeps only the characters its predicate accepts. `String.map Char.toUpper "hello"` gives `"HELLO"`, and removing `'e'` and `'o'` from `"hello"` gives `"hll"`.
Results
elm-0.19.1
passran in 47 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets. map1: "HELLO" filter1: "hll"
elm-0.19.2
passran in 53 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets. map1: "HELLO" filter1: "hll"
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. map1: "HELLO" filter1: "hll"
lamdera-1.5.0
passran in 73 msOutput
map1: "HELLO" filter1: "hll"
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm-core/StringMapFilterTest] in its title.
Source
The -- CHECK: lines give the expected output.
module StringMapFilterTest exposing (main)
{-| Checks that `String.map` transforms every character and `String.filter` keeps only the characters its predicate accepts.
`String.map Char.toUpper "hello"` gives `"HELLO"`, and removing `'e'` and `'o'`
from `"hello"` gives `"hll"`.
-}
-- CHECK: map1: "HELLO"
-- CHECK: filter1: "hll"
import Html exposing (text)
main =
let
_ = Debug.log "map1" (String.map Char.toUpper "hello")
_ = Debug.log "filter1" (String.filter (\c -> c /= 'e' && c /= 'o') "hello")
in
text "done"