twitter-status-bot/.gems/gems/thread_safe-0.3.4/test/test_array.rb

19 lines
375 B
Ruby
Raw Normal View History

2014-09-03 08:49:59 +00:00
require 'thread_safe'
require File.join(File.dirname(__FILE__), "test_helper")
class TestArray < Minitest::Test
def test_concurrency
ary = ThreadSafe::Array.new
(1..100).map do |i|
Thread.new do
1000.times do
ary << i
ary.each {|x| x * 2}
ary.shift
ary.last
end
end
end.map(&:join)
end
end