Browse files

Move hSpec tests for 'lookupPTR' into the (tested) docs for 'lookupPTR'.

  • Loading branch information...
1 parent e2af434 commit 6468fad3715c04a5afb9b29c2d432f2f3776b741 @orlitzky orlitzky committed Sep 12, 2013
Showing with 13 additions and 14 deletions.
  1. +13 −3 Network/DNS/Lookup.hs
  2. +0 −11 test2/LookupSpec.hs
View
16 Network/DNS/Lookup.hs
@@ -318,9 +318,19 @@ lookupTXT rlv dom = do
----------------------------------------------------------------
-{-|
- Resolving 'Domain' and its preference by 'PTR'.
--}
+-- | Look up all \'PTR\' records for the given hostname. To perform a
+-- reverse lookup on an IP address, you must first reverse its
+-- octets and then append the suffix \".in-addr.arpa.\"
+--
+-- We look up the PTR associated with the IP address
+-- 210.130.137.80, i.e., 80.137.130.210.in-addr.arpa:
+--
+-- >>> let hostname = Data.ByteString.Char8.pack "80.137.130.210.in-addr.arpa"
+-- >>>
+-- >>> rs <- makeResolvSeed defaultResolvConf
+-- >>> withResolver rs $ \resolver -> lookupPTR resolver hostname
+-- Right ["www-v4.iij.ad.jp."]
+--
lookupPTR :: Resolver -> Domain -> IO (Either DNSError [Domain])
lookupPTR rlv dom = do
erds <- DNS.lookup rlv dom PTR
View
11 test2/LookupSpec.hs
@@ -17,17 +17,6 @@ spec = do
`shouldReturn`
Right []
- describe "lookupPTR" $ do
- it "gets PTR" $ do
- rs <- makeResolvSeed defaultResolvConf
- withResolver rs $ \resolver -> do
- let target = "210.130.137.80"
- rev = BS.intercalate "." (reverse (BS.split '.' target))
- `BS.append` ".in-addr.arpa"
- DNS.lookupPTR resolver rev
- `shouldReturn`
- Right ["www-v4.iij.ad.jp."]
-
describe "lookupSRV" $ do
it "gets SRV" $ do
rs <- makeResolvSeed defaultResolvConf

0 comments on commit 6468fad

Please sign in to comment.