-
Notifications
You must be signed in to change notification settings - Fork 29
Closed
Description
Doc for function (</>) shows:
parsePath (s "search" </> string) location
-- /search/cats/ ==> Just "cats"
-- /search/frog ==> Just "frog"
-- /search/ ==> Nothing
-- /cats/ ==> Nothing
But parsePath (s "search" </> string) location returns Just "" because the implementation of string is
string : Parser (String -> a) a
string =
custom "STRING" OkNot sure which is correct. Assuming the docs are the desired behaviour:
{-| Parse a segment of the path as a `String`.
parsePath string location
-- /alice/ ==> Just "alice"
-- /bob ==> Just "bob"
-- /42/ ==> Just "42"
-- / ==> Nothing
-}
string : Parser (String -> a) a
string =
custom "STRING" <|
\segment ->
if String.isEmpty segment then
Err "string does not match empty segment"
else
Ok segmentUsing elm-doc-test would catch this earlier.
Caught the issue while working on a PR to add doc tests. Using elm 0.18.0
crypticmind and sethlivingston
Metadata
Metadata
Assignees
Labels
No labels