aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/drb/test_drbobject.rb47
1 files changed, 47 insertions, 0 deletions
diff --git a/test/drb/test_drbobject.rb b/test/drb/test_drbobject.rb
new file mode 100644
index 0000000000..3c7b0c1971
--- /dev/null
+++ b/test/drb/test_drbobject.rb
@@ -0,0 +1,47 @@
+require 'test/unit'
+require 'drb'
+require 'drb/timeridconv'
+
+module DRbObjectTest
+ class Foo
+ def initialize
+ @foo = 'foo'
+ end
+ end
+
+ def teardown
+ DRb.stop_service
+ end
+
+ def drb_eq(obj)
+ proxy = DRbObject.new(obj)
+ assert_equal(obj, DRb.to_obj(proxy.__drbref))
+ end
+
+ def test_DRbObject_id_dereference
+ drb_eq(Foo.new)
+ drb_eq(Foo)
+ drb_eq(File)
+ drb_eq(Enumerable)
+ drb_eq(nil)
+ drb_eq(1)
+ drb_eq($stdout)
+ drb_eq([])
+ end
+end
+
+class TestDRbObject < Test::Unit::TestCase
+ include DRbObjectTest
+
+ def setup
+ DRb.start_service
+ end
+end
+
+class TestDRbObjectTimerIdConv < Test::Unit::TestCase
+ include DRbObjectTest
+
+ def setup
+ DRb.start_service(nil, nil, {:idconv => DRb::TimerIdConv.new})
+ end
+end