Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add loopback tests for if index #391

Merged
merged 4 commits into from
Mar 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion network.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ library
other-modules:
Network.Socket.ByteString.Lazy.Windows
c-sources: cbits/initWinSock.c, cbits/winSockErr.c, cbits/asyncAccept.c
extra-libraries: ws2_32
extra-libraries: ws2_32, iphlpapi
-- See https:/haskell/network/pull/362
if impl(ghc >= 7.10)
cpp-options: -D_WIN32_WINNT=0x0600
Expand Down
15 changes: 15 additions & 0 deletions tests/Network/SocketSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,21 @@ spec = do
let hints = defaultHints { addrFlags = [AI_NUMERICSERV] }
void $ getAddrInfo (Just hints) (Just "localhost") Nothing

#if defined(mingw32_HOST_OS)
let lpdevname = "loopback_0"
#else
let lpdevname = "lo"
#endif

describe "ifNameToIndex" $ do
it "converts a name to an index" $
ifNameToIndex lpdevname `shouldReturn` Just 1

describe "ifIndexToName" $ do
it "converts an index to a name" $
ifIndexToName 1 `shouldReturn` Just lpdevname


when isUnixDomainSocketAvailable $ do
context "unix sockets" $ do
it "basic unix sockets end-to-end" $ do
Expand Down