summaryrefslogtreecommitdiffhomepage
path: root/Test.hs
diff options
context:
space:
mode:
authorGravatar Kazu Yamamoto <kazu@iij.ad.jp>2011-09-05 16:06:17 +0900
committerGravatar Kazu Yamamoto <kazu@iij.ad.jp>2011-09-05 16:06:17 +0900
commit8e28329b12d1cabd0038e5d86c8c8edd9dfe0e5e (patch)
tree5f87044ccdbb90ecee1f48bc78da450cfb59bfd2 /Test.hs
parente368c41a0a1819178429dac733c5bd76d1b67805 (diff)
Supporting PTR.
Diffstat (limited to 'Test.hs')
-rw-r--r--Test.hs12
1 files changed, 12 insertions, 0 deletions
diff --git a/Test.hs b/Test.hs
index 5b6a916..efe7e4b 100644
--- a/Test.hs
+++ b/Test.hs
@@ -7,6 +7,7 @@ import Network.DNS as DNS
import Test.Framework (defaultMain, testGroup, Test)
import Test.Framework.Providers.HUnit
import Test.HUnit hiding (Test)
+import qualified Data.ByteString.Char8 as BS
tests :: [Test]
tests = [
@@ -16,6 +17,7 @@ tests = [
, testCase "lookupTXT" test_lookupTXT
, testCase "lookupAviaMX" test_lookupAviaMX
, testCase "lookupAviaCNAME" test_lookupAviaCNAME
+ , testCase "lookupPTR" test_lookupPTR
]
]
@@ -60,5 +62,15 @@ test_lookupAviaCNAME = do
withResolver rs $ \resolver ->
DNS.lookupA resolver "ghs.google.com" ??= ["72.14.203.121"]
+test_lookupPTR :: IO ()
+test_lookupPTR = do
+ rs <- makeResolvSeed defaultResolvConf
+ withResolver rs $ \resolver ->
+ DNS.lookupPTR resolver rev ?= Just ["www-v4.iij.ad.jp."]
+ where
+ target = "210.130.137.80"
+ rev = BS.intercalate "." (reverse (BS.split '.' target))
+ `BS.append` ".in-addr.arpa"
+
main :: IO ()
main = defaultMain tests