lsquic.cr/spec/lsquic_spec.cr

43 lines
759 B
Crystal
Raw Normal View History

2019-11-13 01:15:43 +00:00
require "./spec_helper"
2019-11-27 17:53:45 +00:00
describe QUIC do
2019-11-13 01:15:43 +00:00
it "works" do
2019-11-27 17:53:45 +00:00
client = QUIC::Client.new("www.youtube.com")
5.times do
client.get("/").status_code.should eq(200)
end
client.close
end
it "works with fibers" do
ch = Channel(Int32).new
5.times do
spawn do
client = QUIC::Client.new("www.youtube.com")
5.times do
ch.send client.get("/").status_code
end
client.close
end
end
(5 * 5).times do
ch.receive.should eq(200)
end
end
it "restarts engine after closing" do
client = QUIC::Client.new("www.youtube.com")
client.get("/").status_code.should eq(200)
client.close
Fiber.yield
client.get("/").status_code.should eq(200)
2019-11-13 01:15:43 +00:00
end
end