mirror of
https://gitea.invidious.io/iv-org/lsquic.cr
synced 2024-08-15 00:43:31 +00:00
Add specs
This commit is contained in:
parent
32aee44d8e
commit
023b4d9195
1 changed files with 37 additions and 4 deletions
|
@ -1,9 +1,42 @@
|
|||
require "./spec_helper"
|
||||
|
||||
describe Lsquic do
|
||||
# TODO: Write tests
|
||||
|
||||
describe QUIC do
|
||||
it "works" do
|
||||
false.should eq(true)
|
||||
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)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue