test/synchronized_test.rb in mailbox-0.2.4 vs test/synchronized_test.rb in mailbox-0.2.5
- old
+ new
@@ -83,6 +83,25 @@
assert_equal "thread 1", clazz.values[1], "2nd wrong"
assert_equal "thread 2", clazz.values[2], "3rd wrong"
assert_equal "thread 2", clazz.values[3], "4th wrong"
end
+
+ def test_support_reentrant_synchronized_access
+ klass = Class.new do
+ include Mailbox
+
+ synchronized
+ def test_method_one
+ test_method_two
+ end
+
+ synchronized
+ def test_method_two
+ true
+ end
+ end
+
+ clazz = klass.new
+ assert clazz.test_method_one
+ end
end