Merge pull request #15 from stackbuilders/chore/fix-warnings-in-tests/issue-13

Fix warnings in tests test-suite
This commit is contained in:
Juan Pedro Villa Isaza 2015-08-26 08:44:27 -05:00
commit 43ec533a03
6 changed files with 25 additions and 3 deletions

View File

@ -20,7 +20,9 @@ tests = [ testGroup "humanize"
----------------------------------------------------
test_humanize1 :: Assertion
test_humanize1 = "Employee salary" @?=
humanize [Word "employee", Word "salary"]
test_humanize2 :: Assertion
test_humanize2 = "Underground" @?= humanize [Word "underground"]

View File

@ -30,22 +30,30 @@ tests = [ testGroup "ordinal"
----------------------------------------------------
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)
----------------------------------------------------

View File

@ -42,13 +42,15 @@ tests = [testGroup "dasherize"
]
]
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 :: Either a b -> Bool
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 @@ prop_parameterize5 s = longestSequenceOf '-' parameterized <= 1
-- 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

View File

@ -20,6 +20,9 @@ tests = [ testGroup "titleize"
----------------------------------------------------
test_titleize1 :: Assertion
test_titleize1 = "Employee Salary" @?=
titleize [Word "Employee", Word "Salary"]
test_titleize2 :: Assertion
test_titleize2 = "Underground" @?= titleize [Word "underground"]

View File

@ -17,4 +17,5 @@ tests = [testGroup "underscore"
]
]
test_underscore :: Assertion
test_underscore = "test_this" @?= underscore [Word "test", Word "this"]

View File

@ -22,6 +22,11 @@ tests = [ testGroup "toUnderscore"
]
]
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"