Results / elm-parser /
ParserAdvancedTokenTest
`Parser.Advanced.token` succeeds on input that starts with the token and fails on input that does not. `matched` runs the token `"="` on `"="` and checks for `Ok`; `failed` runs it on `"x"` and checks for `Err`. Neither inspects the dead ends.
Results
elm-0.19.1
passran in 52 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets. matched: True failed: True
elm-0.19.2
passran in 42 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets. matched: True failed: True
elm-0.19.3
passran in 53 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets. matched: True failed: True
lamdera-1.5.0
passran in 73 msOutput
matched: True failed: True
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm-parser/ParserAdvancedTokenTest] in its title.
Source
The -- CHECK: lines give the expected output.
module ParserAdvancedTokenTest exposing (main)
{-| `Parser.Advanced.token` succeeds on input that starts with the token and fails on input that does not.
`matched` runs the token `"="` on `"="` and checks for `Ok`; `failed` runs it
on `"x"` and checks for `Err`. Neither inspects the dead ends.
-}
-- CHECK: matched: True
-- CHECK: failed: True
import Html exposing (text)
import Parser.Advanced as PA
type Prob
= ExpectingEquals
p : PA.Parser c Prob ()
p =
PA.token (PA.Token "=" ExpectingEquals)
main =
let
ok_ = PA.run p "="
_ = Debug.log "matched"
(case ok_ of
Ok _ -> True
Err _ -> False
)
bad = PA.run p "x"
_ = Debug.log "failed"
(case bad of
Err _ -> True
Ok _ -> False
)
in
text "done"