Elm Exactly
Results / elm-core /

CoreIssue1019StringWordsEmptyTest

Tags:elm19-bug

elm-0.19.1 failelm-0.19.2 failelm-0.19.3 faillamdera-1.5.0 fail

Issue: elm/core#1019

`String.words` of a string with no words returns `[]`.

<https://github.com/elm/core/issues/1019>

The test tries the empty string and three strings of only whitespace (spaces; spaces and a
newline; a tab, newline, carriage return and space). Elm 0.19.1 returns `[""]` for each.

Results

elm-0.19.1

failran in 71 ms
Missing pattern: words empty: []
--- output ---
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets.
words empty: [""]
words blank: [""]
words spaces: [""]
words tab newline return: [""]

elm-0.19.2

failran in 66 ms
Missing pattern: words empty: []
--- output ---
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets.
words empty: [""]
words blank: [""]
words spaces: [""]
words tab newline return: [""]

elm-0.19.3

failran in 41 ms
Missing pattern: words empty: []
--- output ---
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets.
words empty: [""]
words blank: [""]
words spaces: [""]
words tab newline return: [""]

lamdera-1.5.0

failran in 58 ms
Missing pattern: words empty: []
--- output ---
words empty: [""]
words blank: [""]
words spaces: [""]
words tab newline return: [""]

Discussions

Discuss this test·Search the discussions on GitHub

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

Source

The -- CHECK: lines give the expected output.

module CoreIssue1019StringWordsEmptyTest exposing (main)
{-| `String.words` of a string with no words returns `[]`.
<https://github.com/elm/core/issues/1019>
The test tries the empty string and three strings of only whitespace (spaces; spaces and a
newline; a tab, newline, carriage return and space). Elm 0.19.1 returns `[""]` for each.
-}
-- TAGS: elm19-bug
-- CHECK: words empty: []
-- CHECK: words blank: []
-- CHECK: words spaces: []
-- CHECK: words tab newline return: []
import Html exposing (text)
main =
let
_ =
Debug.log "words empty" (String.words "")
_ =
Debug.log "words blank" (String.words " \n ")
_ =
Debug.log "words spaces" (String.words " ")
_ =
Debug.log "words tab newline return" (String.words "\t\n\u{000D} ")
in
text "done"