1 -- | Miscellaneous functions for manipulating string.
8 import Test.Framework (Test, testGroup)
9 import Test.Framework.Providers.HUnit (testCase)
10 import Test.HUnit (Assertion, assertEqual)
13 -- | Takes a list of strings, call them string1, string2, etc. and
14 -- numbers them like a list. So,
20 listify :: [String] -> [String]
22 zipWith (++) list_numbers
24 list_numbers = map show_with_dot [1::Integer ..]
25 show_with_dot x = (show x) ++ ". "
32 test_listify :: Assertion
34 assertEqual description expected_items actual_items
36 description = "All items are numbered correctly."
37 actual_items = listify [ "item1", "item2" ]
38 expected_items = ["1. item1", "2. item2" ]
40 string_utils_tests :: Test
42 testGroup "StringUtils Tests" [ tc1 ]
44 tc1 = testCase "All items are numbered correctly." test_listify