X-Git-Url: http://gitweb.michael.orlitzky.com/?p=dead%2Fhalcyon.git;a=blobdiff_plain;f=src%2FStringUtils.hs;h=210e230f804060527084e7204fce54c473629765;hp=b5feccb3f079a32755784ad2afc63b894802233b;hb=d7c6b5499c0969b6e488d9fc583f93bbb4e3d4c7;hpb=bbd3f429da0e9e5906f6aecb85f1c00683500428 diff --git a/src/StringUtils.hs b/src/StringUtils.hs index b5feccb..210e230 100644 --- a/src/StringUtils.hs +++ b/src/StringUtils.hs @@ -1,8 +1,12 @@ --- |Miscellaneous functions for manipulating string. -module StringUtils +-- | Miscellaneous functions for manipulating string. +module StringUtils ( + listify, + string_utils_tests ) where -import Test.HUnit +import Test.Framework ( Test, testGroup ) +import Test.Framework.Providers.HUnit ( testCase ) +import Test.HUnit ( Assertion, assertEqual ) -- | Takes a list of strings, call them string1, string2, etc. and @@ -20,15 +24,20 @@ listify = show_with_dot x = (show x) ++ ". " +-- +-- Tests +-- -string_utils_tests :: [Test] -string_utils_tests = [ test_listify ] - - -test_listify :: Test +test_listify :: Assertion test_listify = - TestCase $ assertEqual description expected_items actual_items - where - description = "All items are numbered correctly." - actual_items = listify [ "item1", "item2" ] - expected_items = ["1. item1", "2. item2" ] + assertEqual description expected_items actual_items + where + description = "All items are numbered correctly." + actual_items = listify [ "item1", "item2" ] + expected_items = ["1. item1", "2. item2" ] + +string_utils_tests :: Test +string_utils_tests = + testGroup "StringUtils Tests" [ tc1 ] + where + tc1 = testCase "All items are numbered correctly." test_listify