Results / elm-parser /
ParserIssue18IntLeadingZeroTest
Tags:elm19-bug
Issue: elm/parser#18
`Parser.int` succeeds on inputs its documentation says it rejects. <https://github.com/elm/parser/issues/18> The documentation of `int` says `run int "0123" == Err ...` and `run int "123a" == Err ...` (number parsers "peek ahead, making sure they are not followed by anything unexpected"). Elm 0.19.1 (elm/parser 1.1.0) gives `Ok 0` and `Ok 123`; `Ok 0` for "0123" silently drops the digits.
Results
elm-0.19.1
failran in 61 msMissing pattern: {{(^|\n)0123: Err}}
--- output ---
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets.
0123: Ok 0
123a: Ok 123
elm-0.19.2
failran in 68 msMissing pattern: {{(^|\n)0123: Err}}
--- output ---
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets.
0123: Ok 0
123a: Ok 123
elm-0.19.3
failran in 50 msMissing pattern: {{(^|\n)0123: Err}}
--- output ---
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets.
0123: Ok 0
123a: Ok 123
lamdera-1.5.0
failran in 72 msMissing pattern: {{(^|\n)0123: Err}}
--- output ---
0123: Ok 0
123a: Ok 123
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm-parser/ParserIssue18IntLeadingZeroTest] in its title.
Source
The -- CHECK: lines give the expected output.
module ParserIssue18IntLeadingZeroTest exposing (main)
{-| `Parser.int` succeeds on inputs its documentation says it rejects.
<https://github.com/elm/parser/issues/18>
The documentation of `int` says `run int "0123" == Err ...` and `run int "123a" == Err ...` (number
parsers "peek ahead, making sure they are not followed by anything unexpected"). Elm 0.19.1
(elm/parser 1.1.0) gives `Ok 0` and `Ok 123`; `Ok 0` for "0123" silently drops the digits.
-}
-- TAGS: elm19-bug
-- CHECK: {{(^|\n)0123: Err}}
-- CHECK: {{(^|\n)123a: Err}}
import Html exposing (text)
import Parser
main =
let
_ =
Debug.log "0123" (Parser.run Parser.int "0123")
_ =
Debug.log "123a" (Parser.run Parser.int "123a")
in
text "done"