From 3beaa57bb0853ef3ab417a3f1bbbcddc2589cee4 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Tue, 7 Jul 2015 01:16:36 -0400 Subject: [PATCH] More import/export cleanup. --- src/DnsblSite.hs | 13 ++++++------- src/Domain.hs | 4 +++- src/IPv4Pattern.hs | 11 ++++++++++- test/TestSuite.hs | 4 ++-- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/DnsblSite.hs b/src/DnsblSite.hs index 24d8c96..bf87a89 100644 --- a/src/DnsblSite.hs +++ b/src/DnsblSite.hs @@ -4,10 +4,11 @@ -- -- postscreen_dnsbl_sites = bl.mailspike.net=127.0.0.[2;10;11]*2, ... -- --- Here, the 'Domain' is \"bl.mailspike.net\", the return code --- pattern is \"127.0.0.[2;10;11]\", and the weight is \"2". +-- Here, the blacklist (a 'UserDomain') is \"bl.mailspike.net\", the +-- return code pattern is \"127.0.0.[2;10;11]\", and the weight is +-- \"2". -- -module DnsblSite +module DnsblSite () where import Text.Parsec ( @@ -25,7 +26,7 @@ import Text.Parsec ( import Text.Parsec.String ( Parser ) import Text.Read ( readMaybe ) - +import Domain ( UserDomain ) import IPv4Pattern ( IPv4Pattern ) newtype Weight = Weight Int deriving (Eq, Show) @@ -82,7 +83,5 @@ weight = try parse_weight <|> (eof >> return (Weight 1)) Nothing -> unexpected "weight: readMaybe failed on a sequence of digits!" Just k -> return $ Weight (if sign == '-' then negate k else k) -newtype Domain = Domain String - -data DnsblSite = DnsblSite Domain IPv4Pattern Weight +data DnsblSite = DnsblSite UserDomain IPv4Pattern Weight diff --git a/src/Domain.hs b/src/Domain.hs index 3ef6f26..446a8a6 100644 --- a/src/Domain.hs +++ b/src/Domain.hs @@ -5,7 +5,9 @@ -- -- -- -module Domain +module Domain ( + UserDomain, + user_domain ) where import Data.Char ( toLower ) diff --git a/src/IPv4Pattern.hs b/src/IPv4Pattern.hs index dd95b13..8c605ff 100644 --- a/src/IPv4Pattern.hs +++ b/src/IPv4Pattern.hs @@ -21,7 +21,11 @@ -- v4sequence = v4seq_member | v4sequence ";" v4seq_member -- v4seq_member = v4octet | v4octet ".." v4octet -- -module IPv4Pattern +module IPv4Pattern ( + IPv4Pattern, + addresses, + ipv4pattern_tests, + v4pattern) where @@ -416,6 +420,11 @@ addresses (IPv4Pattern field1 field2 field3 field4) = do -- * Tests +ipv4pattern_tests :: TestTree +ipv4pattern_tests = + testGroup "IPv4Pattern Tests" [ v4octet_tests ] + + v4octet_tests :: TestTree v4octet_tests = testGroup diff --git a/test/TestSuite.hs b/test/TestSuite.hs index 83a4dec..c7d9613 100644 --- a/test/TestSuite.hs +++ b/test/TestSuite.hs @@ -1,8 +1,8 @@ import Test.Tasty ( TestTree, defaultMain, testGroup ) -import IPv4Pattern ( v4octet_tests ) +import IPv4Pattern ( ipv4pattern_tests ) tests :: TestTree -tests = testGroup "All Tests" [ v4octet_tests ] +tests = testGroup "All Tests" [ ipv4pattern_tests ] main :: IO () main = defaultMain tests -- 2.44.2