Skip to content

Commit

Permalink
Add synchronization.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Apr 24, 2024
1 parent bf61a9a commit 7641d7e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/io/endpoint/unix_endpoint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
require 'io/endpoint/unix_endpoint'
require 'with_temporary_directory'
require 'sus/fixtures/async/reactor_context'
require 'async/variable'

describe IO::Endpoint::UNIXEndpoint do
include WithTemporaryDirectory
Expand Down Expand Up @@ -67,15 +68,21 @@
include Sus::Fixtures::Async::ReactorContext

it "can send and receive UDP messages" do
bound = Async::Variable.new

server_task = Async do
endpoint.bind do |server|
bound.resolve(true)

expect(server).to be_a(Socket)
packet, address = server.recvfrom(512)

expect(packet).to be == "Hello World!"
end
end

bound.wait

endpoint.connect do |peer|
peer.sendmsg("Hello World!")
end
Expand Down

0 comments on commit 7641d7e

Please sign in to comment.