Elm Exactly
Results / elm-core /

StringJoinTest

elm-0.19.1 passelm-0.19.2 passelm-0.19.3 passlamdera-1.5.0 pass
Checks `String.join` with a multi-character separator, an empty separator, an empty list, a single-element list, and lists of empty strings, plus `String.replace` on an empty string.

`String.join "-" [ "" ]` and `String.join "" [ "", "" ]` must both give the empty
string, as must replacing `"\n"` with `"|"` in `""`.

Results

elm-0.19.1

passran in 44 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets.
join1: "a, b, c"
join_empty_sep: "xy"
join_empty_list: ""
join_single: "only"
join_all_empty: ""
join_empties_no_sep: ""
replace_empty: ""

elm-0.19.2

passran in 58 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets.
join1: "a, b, c"
join_empty_sep: "xy"
join_empty_list: ""
join_single: "only"
join_all_empty: ""
join_empties_no_sep: ""
replace_empty: ""

elm-0.19.3

passran in 44 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets.
join1: "a, b, c"
join_empty_sep: "xy"
join_empty_list: ""
join_single: "only"
join_all_empty: ""
join_empties_no_sep: ""
replace_empty: ""

lamdera-1.5.0

passran in 70 ms
Output
join1: "a, b, c"
join_empty_sep: "xy"
join_empty_list: ""
join_single: "only"
join_all_empty: ""
join_empties_no_sep: ""
replace_empty: ""

Discussions

Discuss this test·Search the discussions on GitHub

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

Source

The -- CHECK: lines give the expected output.

module StringJoinTest exposing (main)
{-| Checks `String.join` with a multi-character separator, an empty separator, an empty list, a single-element list, and lists of empty strings, plus `String.replace` on an empty string.
`String.join "-" [ "" ]` and `String.join "" [ "", "" ]` must both give the empty
string, as must replacing `"\n"` with `"|"` in `""`.
-}
-- CHECK: join1: "a, b, c"
-- CHECK: join_empty_sep: "xy"
-- CHECK: join_empty_list: ""
-- CHECK: join_single: "only"
-- CHECK: join_all_empty: ""
-- CHECK: join_empties_no_sep: ""
-- CHECK: replace_empty: ""
import Html exposing (text)
main =
let
_ =
Debug.log "join1" (String.join ", " [ "a", "b", "c" ])
_ =
Debug.log "join_empty_sep" (String.join "" [ "x", "y" ])
_ =
Debug.log "join_empty_list" (String.join "-" [])
_ =
Debug.log "join_single" (String.join "-" [ "only" ])
_ =
Debug.log "join_all_empty" (String.join "-" [ "" ])
_ =
Debug.log "join_empties_no_sep" (String.join "" [ "", "" ])
_ =
Debug.log "replace_empty" (String.replace "\n" "|" "")
in
text "done"