Elm Exactly
Results / elm-core /

StringZeroLenSplitLongSepTest

elm-0.19.1 passelm-0.19.2 passelm-0.19.3 passlamdera-1.5.0 pass
`String.split` with a separator longer than the input returns the input
unchanged as the single part.

`split_long_sep_utf16` uses the non-ASCII inputs `"é"` and `"éü"` with
separators of two or three characters (`"ab"`, `"abc"`, `"éé"`, `"üéx"`) and
compares each result with `==` against the expected one-element list.
`split_long_sep_ascii` logs `String.split "ab" "a"`, which must be `["a"]`.

Results

elm-0.19.1

passran in 40 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets.
split_long_sep_utf16: [True,True,True,True]
split_long_sep_ascii: ["a"]

elm-0.19.2

passran in 57 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets.
split_long_sep_utf16: [True,True,True,True]
split_long_sep_ascii: ["a"]

elm-0.19.3

passran in 69 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets.
split_long_sep_utf16: [True,True,True,True]
split_long_sep_ascii: ["a"]

lamdera-1.5.0

passran in 42 ms
Output
split_long_sep_utf16: [True,True,True,True]
split_long_sep_ascii: ["a"]

Discussions

Discuss this test·Search the discussions on GitHub

Discussions are on GitHub; one about this test has [t:elm-core/StringZeroLenSplitLongSepTest] in its title.

Source

The -- CHECK: lines give the expected output.

module StringZeroLenSplitLongSepTest exposing (main)
{-| `String.split` with a separator longer than the input returns the input
unchanged as the single part.
`split_long_sep_utf16` uses the non-ASCII inputs `"é"` and `"éü"` with
separators of two or three characters (`"ab"`, `"abc"`, `"éé"`, `"üéx"`) and
compares each result with `==` against the expected one-element list.
`split_long_sep_ascii` logs `String.split "ab" "a"`, which must be `["a"]`.
-}
-- CHECK: split_long_sep_utf16: [True,True,True,True]
-- CHECK: split_long_sep_ascii: ["a"]
import Html exposing (text)
main =
let
_ =
-- compared with == so the expected output holds no non-ASCII text
Debug.log "split_long_sep_utf16"
[ String.split "ab" "é" == [ "é" ]
, String.split "abc" "é" == [ "é" ]
, String.split "éé" "é" == [ "é" ]
, String.split "üéx" "éü" == [ "éü" ]
]
_ =
Debug.log "split_long_sep_ascii" (String.split "ab" "a")
in
text "done"