mirror of
https://github.com/typeable/inflections-hs.git
synced 2024-08-15 17:10:21 +03:00
Allow Word to contain digits (#42)
This commit is contained in:
parent
f3cdc38874
commit
185c506788
@ -51,6 +51,6 @@ parser acronyms = many (acronym acronyms <|> word) <* eof
|
||||
word :: Parser Word
|
||||
word = do
|
||||
firstChar <- upperChar <|> lowerChar
|
||||
restChars <- many lowerChar
|
||||
restChars <- many $ lowerChar <|> digitChar
|
||||
return . Word . T.pack $ firstChar : restChars
|
||||
{-# INLINE word #-}
|
||||
|
@ -7,9 +7,11 @@ import Text.Inflections (toUnderscore, toDashed, toCamelCased)
|
||||
|
||||
spec :: Spec
|
||||
spec = do
|
||||
describe "toUnderscore" $
|
||||
describe "toUnderscore" $ do
|
||||
it "converts camel case to snake case" $
|
||||
toUnderscore "camelCasedText" `shouldReturn` "camel_cased_text"
|
||||
it "converts camel case to snake case with numbers" $
|
||||
toUnderscore "ipv4Address" `shouldReturn` "ipv4_address"
|
||||
describe "toDashed" $
|
||||
it "converts camel case to dashed" $
|
||||
toDashed "camelCasedText" `shouldReturn` "camel-cased-text"
|
||||
|
Loading…
Reference in New Issue
Block a user