Results / elm-parser /
ParserMapChompedStringTest
Checks that `Parser.mapChompedString` passes the consumed text to its function. `chompWhile Char.isAlpha` on `"abc"` consumes `"abc"`, and the function combines that text with its upper-cased form, giving `Ok "abc-ABC"`.
Results
elm-0.19.1
passran in 57 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets. result: Ok "abc-ABC"
elm-0.19.2
passran in 78 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets. result: Ok "abc-ABC"
elm-0.19.3
passran in 85 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets. result: Ok "abc-ABC"
lamdera-1.5.0
passran in 81 msOutput
result: Ok "abc-ABC"
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm-parser/ParserMapChompedStringTest] in its title.
Source
The -- CHECK: lines give the expected output.
module ParserMapChompedStringTest exposing (main)
{-| Checks that `Parser.mapChompedString` passes the consumed text to its function.
`chompWhile Char.isAlpha` on `"abc"` consumes `"abc"`, and the function
combines that text with its upper-cased form, giving `Ok "abc-ABC"`.
-}
-- CHECK: result: Ok "abc-ABC"
import Char
import Html exposing (text)
import Parser
import String
upperWithRaw : Parser.Parser String
upperWithRaw =
Parser.mapChompedString
(\raw _ -> raw ++ "-" ++ String.toUpper raw)
(Parser.chompWhile Char.isAlpha)
main =
let
result = Parser.run upperWithRaw "abc"
_ = Debug.log "result" result
in
text "done"