Files
news.gitea.happylizard.me/bin/gems/eventmachine-1.2.7/tests/test_idle_connection.rb
T
pizza2d1 4cee170d66
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 9s
Add bin and edit workflow
2026-09-16 13:11:16 -06:00

32 lines
653 B
Ruby

require 'em_test_helper'
class TestIdleConnection < Test::Unit::TestCase
def setup
@port = next_port
end
def test_idle_time
omit_if(!EM.respond_to?(:get_idle_time))
a, b = nil, nil
EM.run do
EM.start_server '127.0.0.1', @port, Module.new
conn = EM.connect '127.0.0.1', @port
EM.add_timer(0.3) do
a = conn.get_idle_time
conn.send_data 'a'
EM.next_tick do
EM.next_tick do
b = conn.get_idle_time
conn.close_connection
EM.stop
end
end
end
end
assert_in_delta 0.3, a, 0.1
assert_in_delta 0, b, 0.1
end
end