Elm Exactly
Results / elm-parser /

ParserIssue24GetIndentDefaultTest

Tags:elm19-bug

elm-0.19.1 failelm-0.19.2 failelm-0.19.3 faillamdera-1.5.0 fail

Issue: elm/parser#24

`getIndent` without any `withIndent` returns 1, not the documented default 0.

<https://github.com/elm/parser/issues/24>

The documentation says "`getIndent` results in `0`, the default value" and that
`succeed Tuple.pair |= withIndent 4 getIndent |= getIndent` gives `(4,0)`. Elm 0.19.1
(elm/parser 1.1.0) gives 1 and `(4,1)`.

Results

elm-0.19.1

failran in 55 ms
Missing pattern: indent: Ok 0
--- output ---
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets.
indent: Ok 1
pair: Ok (4,1)

elm-0.19.2

failran in 57 ms
Missing pattern: indent: Ok 0
--- output ---
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets.
indent: Ok 1
pair: Ok (4,1)

elm-0.19.3

failran in 57 ms
Missing pattern: indent: Ok 0
--- output ---
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets.
indent: Ok 1
pair: Ok (4,1)

lamdera-1.5.0

failran in 62 ms
Missing pattern: indent: Ok 0
--- output ---
indent: Ok 1
pair: Ok (4,1)

Discussions

Discuss this test·Search the discussions on GitHub

Discussions are on GitHub; one about this test has [t:elm-parser/ParserIssue24GetIndentDefaultTest] in its title.

Source

The -- CHECK: lines give the expected output.

module ParserIssue24GetIndentDefaultTest exposing (main)
{-| `getIndent` without any `withIndent` returns 1, not the documented default 0.
<https://github.com/elm/parser/issues/24>
The documentation says "`getIndent` results in `0`, the default value" and that
`succeed Tuple.pair |= withIndent 4 getIndent |= getIndent` gives `(4,0)`. Elm 0.19.1
(elm/parser 1.1.0) gives 1 and `(4,1)`.
-}
-- TAGS: elm19-bug
-- CHECK: indent: Ok 0
-- CHECK: pair: Ok (4,0)
import Html exposing (text)
import Parser exposing ((|=))
main =
let
_ =
Debug.log "indent" (Parser.run Parser.getIndent "")
_ =
Debug.log "pair"
(Parser.run
(Parser.succeed Tuple.pair
|= Parser.withIndent 4 Parser.getIndent
|= Parser.getIndent
)
""
)
in
text "done"