1 -- | Miscellaneous functions for manipulating string.
5 import Test.Framework (Test, testGroup)
6 import Test.Framework.Providers.HUnit (testCase)
7 import Test.HUnit (Assertion, assertEqual)
10 -- | Takes a list of strings, call them string1, string2, etc. and
11 -- numbers them like a list. So,
17 listify :: [String] -> [String]
19 zipWith (++) list_numbers
21 list_numbers = map show_with_dot [1::Integer ..]
22 show_with_dot x = (show x) ++ ". "
29 test_listify :: Assertion
31 assertEqual description expected_items actual_items
33 description = "All items are numbered correctly."
34 actual_items = listify [ "item1", "item2" ]
35 expected_items = ["1. item1", "2. item2" ]
37 string_utils_tests :: Test
39 testGroup "StringUtils Tests" [ tc1 ]
41 tc1 = testCase "All items are numbered correctly." test_listify