summaryrefslogtreecommitdiff
path: root/test/rake/test_thread_history_display.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-04-04 12:31:31 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-04-04 12:31:31 +0000
commitc4ee0df8ba2cf7cc6aaa785c8df20a91b1719021 (patch)
tree06beca468cce4a75a3e9890d18aa001ef2c41e54 /test/rake/test_thread_history_display.rb
parent8c0b2a286080609613b6b007e030ff7c7adaa23c (diff)
* lib/rake/*: Gemify rake [fix GH-862][Feature #11025]
* test/rake/*: ditto. * tool/rbinstall.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rake/test_thread_history_display.rb')
-rw-r--r--test/rake/test_thread_history_display.rb101
1 files changed, 0 insertions, 101 deletions
diff --git a/test/rake/test_thread_history_display.rb b/test/rake/test_thread_history_display.rb
deleted file mode 100644
index bb5879cff5..0000000000
--- a/test/rake/test_thread_history_display.rb
+++ /dev/null
@@ -1,101 +0,0 @@
-require File.expand_path('../helper', __FILE__)
-
-require 'rake/thread_history_display'
-
-class TestThreadHistoryDisplay < Rake::TestCase
- def setup
- super
- @time = 1_000_000
- @stats = []
- @display = Rake::ThreadHistoryDisplay.new(@stats)
- end
-
- def test_banner
- out, _ = capture_io do
- @display.show
- end
- assert_match(/Job History/i, out)
- end
-
- def test_item_queued
- @stats << event(:item_queued, :item_id => 123)
- out, _ = capture_io do
- @display.show
- end
- assert_match(/^ *1000000 +A +item_queued +item_id:1$/, out)
- end
-
- def test_item_dequeued
- @stats << event(:item_dequeued, :item_id => 123)
- out, _ = capture_io do
- @display.show
- end
- assert_match(/^ *1000000 +A +item_dequeued +item_id:1$/, out)
- end
-
- def test_multiple_items
- @stats << event(:item_queued, :item_id => 123)
- @stats << event(:item_queued, :item_id => 124)
- out, _ = capture_io do
- @display.show
- end
- assert_match(/^ *1000000 +A +item_queued +item_id:1$/, out)
- assert_match(/^ *1000001 +A +item_queued +item_id:2$/, out)
- end
-
- def test_waiting
- @stats << event(:waiting, :item_id => 123)
- out, _ = capture_io do
- @display.show
- end
- assert_match(/^ *1000000 +A +waiting +item_id:1$/, out)
- end
-
- def test_continue
- @stats << event(:continue, :item_id => 123)
- out, _ = capture_io do
- @display.show
- end
- assert_match(/^ *1000000 +A +continue +item_id:1$/, out)
- end
-
- def test_thread_deleted
- @stats << event(
- :thread_deleted,
- :deleted_thread => 123_456,
- :thread_count => 12)
- out, _ = capture_io do
- @display.show
- end
- assert_match(
- /^ *1000000 +A +thread_deleted( +deleted_thread:B| +thread_count:12){2}$/,
- out)
- end
-
- def test_thread_created
- @stats << event(
- :thread_created,
- :new_thread => 123_456,
- :thread_count => 13)
- out, _ = capture_io do
- @display.show
- end
- assert_match(
- /^ *1000000 +A +thread_created( +new_thread:B| +thread_count:13){2}$/,
- out)
- end
-
- private
-
- def event(type, data = {})
- result = {
- :event => type,
- :time => @time / 1_000_000.0,
- :data => data,
- :thread => Thread.current.object_id
- }
- @time += 1
- result
- end
-
-end