Elm Exactly
Results / elm-parser /

ParserChompUntilTest

elm-0.19.1 passelm-0.19.2 passelm-0.19.3 passlamdera-1.5.0 pass
`Parser.chompUntil` chomps up to the first occurrence of a string and leaves that string unchomped.

Chomping until `"end"` in `"abc end xyz"` gives `Ok "abc "` from
`getChompedString`: the space before `"end"` is included and `"end"` is not.

Among what is not tested: input where the string never appears, which is an
error.

Results

elm-0.19.1

passran in 62 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets.
until: Ok "abc "

elm-0.19.2

passran in 65 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets.
until: Ok "abc "

elm-0.19.3

passran in 49 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets.
until: Ok "abc "

lamdera-1.5.0

passran in 78 ms
Output
until: Ok "abc "

Discussions

Discuss this test·Search the discussions on GitHub

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

Source

The -- CHECK: lines give the expected output.

module ParserChompUntilTest exposing (main)
{-| `Parser.chompUntil` chomps up to the first occurrence of a string and leaves that string unchomped.
Chomping until `"end"` in `"abc end xyz"` gives `Ok "abc "` from
`getChompedString`: the space before `"end"` is included and `"end"` is not.
Among what is not tested: input where the string never appears, which is an
error.
-}
-- CHECK: until: Ok "abc "
import Html exposing (text)
import Parser
main =
let
p = Parser.getChompedString (Parser.chompUntil "end")
result = Parser.run p "abc end xyz"
_ = Debug.log "until" result
in
text "done"