Skip to content

Commit 166f5af

Browse files
committed
typed-protocols-examples: fixed a socket test on macos
1 parent a81caa1 commit 166f5af

File tree

2 files changed

+10
-2
lines changed
  • typed-protocols-examples/test/Network/TypedProtocol

2 files changed

+10
-2
lines changed

typed-protocols-examples/test/Network/TypedProtocol/PingPong/Tests.hs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,11 @@ prop_namedPipePipelined_IO (NonNegative n) = ioProperty $ do
349349
prop_socketPipelined_IO :: NonNegative Int
350350
-> Property
351351
prop_socketPipelined_IO (NonNegative n) = ioProperty $ do
352-
ai : _ <- Socket.getAddrInfo Nothing (Just "127.0.0.1") Nothing
352+
ai : _ <- Socket.getAddrInfo (Just Socket.defaultHints
353+
{ Socket.addrFamily = Socket.AF_INET,
354+
Socket.addrFlags = [Socket.AI_PASSIVE],
355+
Socket.addrSocketType = Socket.Stream })
356+
(Just "127.0.0.1") Nothing
353357
bracket
354358
((,) <$> Socket.openSocket ai
355359
<*> Socket.openSocket ai)

typed-protocols-examples/test/Network/TypedProtocol/ReqResp/Tests.hs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,11 @@ prop_namedPipePipelined_IO f xs = ioProperty $ do
265265
prop_socketPipelined_IO :: (Int -> Int -> (Int, Int)) -> [Int]
266266
-> Property
267267
prop_socketPipelined_IO f xs = ioProperty $ do
268-
ai : _ <- Socket.getAddrInfo Nothing (Just "127.0.0.1") Nothing
268+
ai : _ <- Socket.getAddrInfo (Just Socket.defaultHints
269+
{ Socket.addrFamily = Socket.AF_INET,
270+
Socket.addrFlags = [Socket.AI_PASSIVE],
271+
Socket.addrSocketType = Socket.Stream })
272+
(Just "127.0.0.1") Nothing
269273
bracket
270274
((,) <$> Socket.openSocket ai
271275
<*> Socket.openSocket ai)

0 commit comments

Comments
 (0)