aboutsummaryrefslogtreecommitdiffstats
path: root/test/core
diff options
context:
space:
mode:
authorToshiaki Asai <toshi.alternative@gmail.com>2013-08-23 13:34:06 +0900
committerToshiaki Asai <toshi.alternative@gmail.com>2013-08-23 13:34:06 +0900
commit22887fa36f2de81f6577801e949c73fe08c595c7 (patch)
treef92dca0a1832d5f74c2bb5145568d8168882cb11 /test/core
parentbeae81af21861a4a29d8be3e27f75d57f5c093ea (diff)
downloadmikutter-22887fa36f2de81f6577801e949c73fe08c595c7.tar.gz
起動終了後はフィルタを別スレッドで実行
Diffstat (limited to 'test/core')
-rw-r--r--test/core/test_plugin.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/core/test_plugin.rb b/test/core/test_plugin.rb
index 39082111..6cc81de1 100644
--- a/test/core/test_plugin.rb
+++ b/test/core/test_plugin.rb
@@ -27,6 +27,35 @@ class TC_Plugin < Test::Unit::TestCase
assert_equal(2, sum)
end
+ must "filter in another thread" do
+ filter_thread = nil
+ Plugin.create(:event) do
+ on_thread do
+ end
+
+ filter_thread do
+ filter_thread = Thread.current
+ []
+ end
+ end
+ Event[:thread].call
+ Delayer.run while not Delayer.empty?
+ assert filter_thread
+ assert_equal Thread.current, filter_thread
+
+ Event.filter_another_thread = true
+ filter_thread = nil
+ r = true
+ Event[:thread].call.next{ r = false }.trap{ r = false }
+
+ Delayer.run while r
+ # p r
+ # p SerialThread.instance_eval{ @queue.size }
+ # p Delayer.empty?
+ assert filter_thread
+ assert_not_equal Thread.current, filter_thread
+ end
+
must "uninstall" do
sum = 0
Plugin.create(:event) do
@@ -119,3 +148,4 @@ class TC_Plugin < Test::Unit::TestCase
end
end
+