1 -- | Miscellaneous functions for manipulating string.
7 import Test.Tasty ( TestTree, testGroup )
8 import Test.Tasty.HUnit ( (@?=), testCase )
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 string_utils_tests :: TestTree
31 testGroup "StringUtils Tests" [ test_listify ]
33 test_listify :: TestTree
34 test_listify = testCase description $ actual @?= expected
36 description = "all items are numbered correctly"
37 actual = listify [ "item1", "item2" ]
38 expected = ["1. item1", "2. item2" ]