mirror of
https://github.com/jlengrand/elm-plural-rules.git
synced 2026-03-10 08:11:24 +00:00
add string case behaviour description and tests
This commit is contained in:
@@ -55,12 +55,15 @@ import Dict.Any exposing (AnyDict)
|
||||
{-| Rules are a dictionary with various plural forms of words in your given
|
||||
language.
|
||||
|
||||
Elsewhere you can supply a function giving the default case (in English
|
||||
Elsewhere you can supply a function giving the default pluralization (in English
|
||||
that's adding a `-s` suffix), but here in `Rules` you'll have to supply the
|
||||
"exceptions" (like words that add an `-es` suffix instead).
|
||||
|
||||
For an example see `fromList`.
|
||||
|
||||
Note `Rules` don't do anything about case at all! If they contain `"query"` but
|
||||
you then try to `pluralize 5 "Query"`, the `query` rule _won't_ get used!
|
||||
|
||||
-}
|
||||
type Rules
|
||||
= Rules (Dict String (AnyDict Int Cardinal String))
|
||||
|
||||
@@ -43,6 +43,14 @@ fromFloatInt =
|
||||
\int string ->
|
||||
PluralRules.fromInt config PluralRules.empty int string
|
||||
|> Expect.equal (PluralRules.fromFloat config PluralRules.empty (toFloat int) string)
|
||||
, test "doesn't do anything about case" <|
|
||||
\() ->
|
||||
PluralRules.fromInt config rulesWithQuery 2 "Query"
|
||||
|> Expect.equal "Query"
|
||||
, test "connects if the case is the same" <|
|
||||
\() ->
|
||||
PluralRules.fromInt config rulesWithQuery 2 "query"
|
||||
|> Expect.equal "queries"
|
||||
]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user