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

19 lines
375 B
Ruby

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