inflections 0.2.0.0 → 0.2.0.1
raw patch · 8 files changed
+29/−7 lines, 8 filesdep ~basenew-uploaderPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base
API changes (from Hackage documentation)
- Text.Inflections.Parse.Types: instance Eq Word
- Text.Inflections.Parse.Types: instance Show Word
+ Text.Inflections.Parse.Types: instance GHC.Classes.Eq Text.Inflections.Parse.Types.Word
+ Text.Inflections.Parse.Types: instance GHC.Show.Show Text.Inflections.Parse.Types.Word
Files
- LICENSE +1/−1
- inflections.cabal +3/−3
- test/Text/Inflections/HumanizeTest.hs +2/−0
- test/Text/Inflections/OrdinalTest.hs +8/−0
- test/Text/Inflections/Tests.hs +6/−3
- test/Text/Inflections/TitleizeTest.hs +3/−0
- test/Text/Inflections/UnderscoreTest.hs +1/−0
- test/Text/InflectionsTest.hs +5/−0
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2014 Justin Leitgeb+Copyright (c) 2014-2016 Justin Leitgeb MIT License
inflections.cabal view
@@ -1,5 +1,5 @@ name: inflections-version: 0.2.0.0+version: 0.2.0.1 synopsis: Inflections library for Haskell description: Inflections provides methods for singularization, pluralization,@@ -41,7 +41,7 @@ , Text.Inflections.Parse.CamelCase ghc-options: -Wall- build-depends: base >=4.2 && <4.9, parsec, containers+ build-depends: base >=4.2 && <4.10, parsec, containers default-language: Haskell2010 test-suite test@@ -50,7 +50,7 @@ main-is: Suite.hs build-depends: inflections- , base >=4.2 && <4.9+ , base >=4.2 && <4.10 , test-framework , HUnit , QuickCheck
test/Text/Inflections/HumanizeTest.hs view
@@ -20,7 +20,9 @@ ---------------------------------------------------- +test_humanize1 :: Assertion test_humanize1 = "Employee salary" @?= humanize [Word "employee", Word "salary"] +test_humanize2 :: Assertion test_humanize2 = "Underground" @?= humanize [Word "underground"]
test/Text/Inflections/OrdinalTest.hs view
@@ -30,22 +30,30 @@ ---------------------------------------------------- +test_ordinal1 :: Assertion test_ordinal1 = "st" @?= ordinal 1 +test_ordinal2 :: Assertion test_ordinal2 = "nd" @?= ordinal 2 +test_ordinal1002 :: Assertion test_ordinal1002 = "nd" @?= ordinal 1002 +test_ordinal1003 :: Assertion test_ordinal1003 = "rd" @?= ordinal 1003 +test_ordinalNegative11 :: Assertion test_ordinalNegative11 = "th" @?= ordinal (-11) +test_ordinalNegative1021 :: Assertion test_ordinalNegative1021 = "st" @?= ordinal (-1021) ---------------------------------------------------- +test_ordinalize1 :: Assertion test_ordinalize1 = "1st" @?= ordinalize 1 +test_ordinalizeNegative1021 :: Assertion test_ordinalizeNegative1021 = "-1021st" @?= ordinalize (-1021) ----------------------------------------------------
test/Text/Inflections/Tests.hs view
@@ -42,13 +42,15 @@ ] ] -+test_correctTransliterationWithoutSubs :: Assertion test_correctTransliterationWithoutSubs = transliterate "this is a test" @?= "this is a test" +test_correctTransliterationWithSubs :: Assertion test_correctTransliterationWithSubs = transliterate "Feliz año nuevo" @?= "Feliz ano nuevo" +test_correctTransliterationMissingSubs :: Assertion test_correctTransliterationMissingSubs = transliterate "Have a ❤ ñ!" @?= "Have a ? n!" @@ -61,7 +63,7 @@ isRight (Left _) = False isRight (Right _) = True -+test_dasherize1 :: Assertion test_dasherize1 = "foo-bar" @?= dasherize [Word "foo", Word "bar"] prop_parameterize1 :: String -> Bool@@ -92,12 +94,13 @@ -- Helper functions and shared tests longestSequenceOf :: Char -> String -> Int-longestSequenceOf c [] = 0+longestSequenceOf _ [] = 0 longestSequenceOf c s = if null subseqLengths then 0 else maximum subseqLengths where subseqLengths = (map length . filter (\str -> head str == c) . group) s +numMatching :: Eq a => a -> [a] -> Int numMatching char str = length $ filter (== char) str alphaNumerics :: String
test/Text/Inflections/TitleizeTest.hs view
@@ -20,6 +20,9 @@ ---------------------------------------------------- +test_titleize1 :: Assertion test_titleize1 = "Employee Salary" @?= titleize [Word "Employee", Word "Salary"]++test_titleize2 :: Assertion test_titleize2 = "Underground" @?= titleize [Word "underground"]
test/Text/Inflections/UnderscoreTest.hs view
@@ -17,4 +17,5 @@ ] ] +test_underscore :: Assertion test_underscore = "test_this" @?= underscore [Word "test", Word "this"]
test/Text/InflectionsTest.hs view
@@ -22,6 +22,11 @@ ] ] +test_to_underscore :: Assertion test_to_underscore = "camel_cased_text" @?= toUnderscore "camelCasedText"++test_to_dashed :: Assertion test_to_dashed = "camel-cased-text" @?= toDashed "camelCasedText"++test_to_camel_cased :: Assertion test_to_camel_cased = "underscoredText" @?= toCamelCased False "underscored_text"