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