Results / elm-parser /
ParserIntTest
Checks that `Parser.int` reads a decimal integer and fails on non-numeric input. `"123456"` parses to `Ok 123456`; `"abc"` gives an `Err`.
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. parsed_int: Ok 123456 parse_fail: 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. parsed_int: Ok 123456 parse_fail: True
elm-0.19.3
passran in 41 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets. parsed_int: Ok 123456 parse_fail: True
lamdera-1.5.0
passran in 51 msOutput
parsed_int: Ok 123456 parse_fail: True
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm-parser/ParserIntTest] in its title.
Source
The -- CHECK: lines give the expected output.
module ParserIntTest exposing (main)
{-| Checks that `Parser.int` reads a decimal integer and fails on non-numeric input.
`"123456"` parses to `Ok 123456`; `"abc"` gives an `Err`.
-}
-- CHECK: parsed_int: Ok 123456
-- CHECK: parse_fail: True
import Html exposing (text)
import Parser
main =
let
_ = Debug.log "parsed_int" (Parser.run Parser.int "123456")
failed = Parser.run Parser.int "abc"
_ = Debug.log "parse_fail"
(case failed of
Err _ -> True
Ok _ -> False
)
in
text "done"