X-Git-Url: http://gitweb.michael.orlitzky.com/?p=dead%2Fhalcyon.git;a=blobdiff_plain;f=src%2FStringUtils.hs;h=a9e2625289c65be857d068f35a850e32009369ae;hp=b5feccb3f079a32755784ad2afc63b894802233b;hb=e3864f89a0cae34d4d280efeb52ea5f761ddb44a;hpb=bbd3f429da0e9e5906f6aecb85f1c00683500428 diff --git a/src/StringUtils.hs b/src/StringUtils.hs index b5feccb..a9e2625 100644 --- a/src/StringUtils.hs +++ b/src/StringUtils.hs @@ -1,9 +1,11 @@ --- |Miscellaneous functions for manipulating string. -module StringUtils +-- | Miscellaneous functions for manipulating string. +module StringUtils ( + listify, + string_utils_tests ) where -import Test.HUnit - +import Test.Tasty ( TestTree, testGroup ) +import Test.Tasty.HUnit ( (@?=), testCase ) -- | Takes a list of strings, call them string1, string2, etc. and -- numbers them like a list. So, @@ -20,15 +22,17 @@ listify = show_with_dot x = (show x) ++ ". " +-- +-- Tests +-- -string_utils_tests :: [Test] -string_utils_tests = [ test_listify ] - +string_utils_tests :: TestTree +string_utils_tests = + testGroup "StringUtils Tests" [ test_listify ] -test_listify :: Test -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" ] +test_listify :: TestTree +test_listify = testCase description $ actual @?= expected + where + description = "all items are numbered correctly" + actual = listify [ "item1", "item2" ] + expected = ["1. item1", "2. item2" ]