Results / elm-parser /
ParserEndTest
`Parser.end` succeeds only when no input is left. The parser reads the symbol `"abc"` and then `end`. `at_end` runs it on `"abc"` and checks for `Ok`; `not_end` runs it on `"abcx"` and checks for `Err`.
Results
elm-0.19.1
passran in 53 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets. at_end: True not_end: True
elm-0.19.2
passran in 48 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets. at_end: True not_end: True
elm-0.19.3
passran in 49 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets. at_end: True not_end: True
lamdera-1.5.0
passran in 70 msOutput
at_end: True not_end: True
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm-parser/ParserEndTest] in its title.
Source
The -- CHECK: lines give the expected output.
module ParserEndTest exposing (main)
{-| `Parser.end` succeeds only when no input is left.
The parser reads the symbol `"abc"` and then `end`. `at_end` runs it on
`"abc"` and checks for `Ok`; `not_end` runs it on `"abcx"` and checks for
`Err`.
-}
-- CHECK: at_end: True
-- CHECK: not_end: True
import Html exposing (text)
import Parser exposing ((|.))
myParser : Parser.Parser ()
myParser =
Parser.succeed ()
|. Parser.symbol "abc"
|. Parser.end
main =
let
ok_ = Parser.run myParser "abc"
_ = Debug.log "at_end"
(case ok_ of
Ok _ -> True
Err _ -> False
)
bad = Parser.run myParser "abcx"
_ = Debug.log "not_end"
(case bad of
Err _ -> True
Ok _ -> False
)
in
text "done"