1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/test/drb/ut_timerholder.rb
seki e143a74191 don't use keeper thread. [Bug #12342]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55008 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-15 11:59:00 +00:00

38 lines
717 B
Ruby

# frozen_string_literal: false
require 'test/unit'
require 'drb/timeridconv'
module DRbTests
class TimerIdConvTest < Test::Unit::TestCase
def test_usecase_01
keeping = 0.1
idconv = DRb::TimerIdConv.new(keeping)
key = idconv.to_id(self)
assert_equal(key, self.__id__)
sleep(keeping)
assert_equal(idconv.to_id(false), false.__id__)
assert_equal(idconv.to_obj(key), self)
sleep(keeping)
assert_equal(idconv.to_obj(key), self)
sleep(keeping)
assert_equal(idconv.to_id(true), true.__id__)
sleep(keeping)
assert_raise do
assert_equal(idconv.to_obj(key))
end
assert_raise do
assert_equal(idconv.to_obj(false.__id__))
end
end
end
end