Skip to content

Commit

Permalink
Don't create our own Compat.Sockets (from #545, #594)
Browse files Browse the repository at this point in the history
Note that this still leaves `import Socket` so `using Compat.Sockets`
will still work, although this should be deprecated in the future.
  • Loading branch information
martinholters committed Sep 29, 2019
1 parent e5e3d01 commit d08d177
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 33 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,6 @@ Currently, the `@compat` macro supports the following syntaxes:
* `using Compat.Markdown` is provided on versions older than 0.7, where this library is
not yet part of the standard library ([#25738]).

* `using Compat.Sockets` is provided on versions older than 0.7, where this library is
not yet part of the standard library ([#25935])

* `using Compat.Statistics` is provided on versions older than 0.7, where this library is
not yet part of the standard library ([#27834]).

Expand Down
18 changes: 2 additions & 16 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,8 @@ VERSION < v"0.7.0-beta2.199" && __precompile__()

module Compat

# https://github.com/JuliaLang/julia/pull/25935
if VERSION < v"0.7.0-DEV.4442"
@eval module Sockets
import Base:
@ip_str, IPAddr, IPv4, IPv6, UDPSocket, TCPSocket, DNSError,
accept, connect, getaddrinfo, getipaddr, getsockname, listen,
listenany, recv, recvfrom, send, bind

export
@ip_str, IPAddr, IPv4, IPv6, UDPSocket, TCPSocket,
accept, connect, getaddrinfo, getipaddr, getsockname, listen,
listenany, recv, recvfrom, send, bind
end
else
import Sockets
end
# to be deprecated
import Sockets

include("compatmacro.jl")

Expand Down
15 changes: 15 additions & 0 deletions test/old.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# tests of functionality to be deprecated

# 0.7.0-DEV.3666
module TestSockets
using Compat
using Compat.Sockets
using Compat.Test

@test isdefined(@__MODULE__, :UDPSocket)
@test isdefined(@__MODULE__, :connect)
@test isdefined(@__MODULE__, :listen)
@test isdefined(@__MODULE__, :recv)

@test ip"127.0.0.1".host == UInt32(2130706433)
end
16 changes: 2 additions & 14 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -913,20 +913,6 @@ import Compat.Markdown
@test stderr === STDERR
end

# 0.7.0-DEV.3666
module TestSockets
using Compat
using Compat.Sockets
using Compat.Test

@test isdefined(@__MODULE__, :UDPSocket)
@test isdefined(@__MODULE__, :connect)
@test isdefined(@__MODULE__, :listen)
@test isdefined(@__MODULE__, :recv)

@test ip"127.0.0.1".host == UInt32(2130706433)
end

# 0.7.0-DEV.3526
module TestNames
export foo
Expand Down Expand Up @@ -1517,4 +1503,6 @@ if VERSION >= v"0.7"
end
end

include("old.jl")

nothing

0 comments on commit d08d177

Please sign in to comment.