StringIndexesTest
Checks that `String.indexes` returns every position where a substring occurs, and an empty list when it never does. `"he"` occurs in `"he says hello"` at positions 0 and 8; `"xyz"` does not occur in `"hello"`.
Results
elm-0.19.1
passran in 60 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets. indexes1: [0,8] indexes_none: []
elm-0.19.2
passran in 45 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets. indexes1: [0,8] indexes_none: []
elm-0.19.3
passran in 53 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets. indexes1: [0,8] indexes_none: []
lamdera-1.5.0
passran in 68 msOutput
indexes1: [0,8] indexes_none: []
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm-core/StringIndexesTest] in its title.
Source
The -- CHECK: lines give the expected output.
module StringIndexesTest exposing (main)
{-| Checks that `String.indexes` returns every position where a substring occurs, and an empty list when it never does.
`"he"` occurs in `"he says hello"` at positions 0 and 8; `"xyz"` does not occur
in `"hello"`.
-}
-- CHECK: indexes1: [0,8]
-- CHECK: indexes_none: []
import Html exposing (text)
main =
let
_ = Debug.log "indexes1" (String.indexes "he" "he says hello")
_ = Debug.log "indexes_none" (String.indexes "xyz" "hello")
in
text "done"