summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorseki <seki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-05-22 11:03:43 (GMT)
committerseki <seki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-05-22 11:03:43 (GMT)
commit021e8ead5c4296792db030e62ab4190c9d6617be (patch)
treeb4ec215428c353b712aa7f8cf5020d38da30f6f7 /test
parent0bf2e5c70bd153db6dd0d49552ad4db1a18a6097 (diff)
use finalizer trick instead of thread.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/drb/ut_timerholder.rb42
1 files changed, 39 insertions, 3 deletions
diff --git a/test/drb/ut_timerholder.rb b/test/drb/ut_timerholder.rb
index 252c7bd..1753b30 100644
--- a/test/drb/ut_timerholder.rb
+++ b/test/drb/ut_timerholder.rb
@@ -12,7 +12,6 @@ class TimerIdConvTest < Test::Unit::TestCase
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)
@@ -24,11 +23,48 @@ class TimerIdConvTest < Test::Unit::TestCase
sleep(keeping)
assert_raise do
- assert_equal(idconv.to_obj(key))
+ assert_equal(idconv.to_obj(key), self)
+ end
+
+ assert_raise do
+ assert_equal(idconv.to_obj(false.__id__), false)
+ end
+
+ key = idconv.to_id(self)
+ assert_equal(key, self.__id__)
+ assert_equal(idconv.to_id(true), true.__id__)
+ sleep(keeping)
+ GC.start
+ sleep(keeping)
+ GC.start
+ assert_raise do
+ assert_equal(idconv.to_obj(key), self)
end
+ end
+ def test_usecase_02
+ keeping = 0.1
+ idconv = DRb::TimerIdConv.new(keeping)
+
+ key = idconv.to_id(self)
+ assert_equal(key, self.__id__)
+ sleep(keeping)
+ GC.start
+ sleep(keeping)
+ GC.start
+ assert_raise do
+ assert_equal(idconv.to_obj(key), self)
+ end
+ GC.start
+
+ key = idconv.to_id(self)
+ assert_equal(key, self.__id__)
+ sleep(keeping)
+ GC.start
+ sleep(keeping)
+ GC.start
assert_raise do
- assert_equal(idconv.to_obj(false.__id__))
+ assert_equal(idconv.to_obj(key), self)
end
end
end