module DNS (
LookupResult,
+ dns_tests,
lookupMX',
lookupNS',
normalize,
rdata,
rrtype,
withResolver )
+import Test.Framework (Test, testGroup)
+import Test.Framework.Providers.HUnit (testCase)
+import Test.HUnit (assertEqual)
import Text.Read (readMaybe)
type LookupResult = (Domain, Maybe [Domain])
normalize_case :: Domain -> Domain
normalize_case = BS.map toLower
+
+
+test_normalize_case :: Test
+test_normalize_case =
+ testCase desc $
+ assertEqual desc expected actual
+ where
+ desc = "normalize_case lowercases DNS names"
+ expected = BS.pack "example.com"
+ actual = normalize_case $ BS.pack "ExAmPlE.COM"
+
+dns_tests :: Test
+dns_tests =
+ testGroup "DNS Tests" [
+ test_normalize_case ]