Results / elm-parser /
ParserSucceedTest
Checks that `Parser.succeed` returns its value without consuming input. `succeed 42` on `"anything"` gives `Ok 42`, which also shows that `Parser.run` does not require the input to be fully consumed. `succeed "hello"` on the empty string gives `Ok "hello"`.
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. succeed_result: Ok 42 succeed_string: Ok "hello"
elm-0.19.2
passran in 50 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets. succeed_result: Ok 42 succeed_string: Ok "hello"
elm-0.19.3
passran in 72 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets. succeed_result: Ok 42 succeed_string: Ok "hello"
lamdera-1.5.0
passran in 57 msOutput
succeed_result: Ok 42 succeed_string: Ok "hello"
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm-parser/ParserSucceedTest] in its title.
Source
The -- CHECK: lines give the expected output.
module ParserSucceedTest exposing (main)
{-| Checks that `Parser.succeed` returns its value without consuming input.
`succeed 42` on `"anything"` gives `Ok 42`, which also shows that `Parser.run`
does not require the input to be fully consumed. `succeed "hello"` on the empty
string gives `Ok "hello"`.
-}
-- CHECK: succeed_result: Ok 42
-- CHECK: succeed_string: Ok "hello"
import Html exposing (text)
import Parser
main =
let
_ = Debug.log "succeed_result" (Parser.run (Parser.succeed 42) "anything")
_ = Debug.log "succeed_string" (Parser.run (Parser.succeed "hello") "")
in
text "done"