summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-08-30 06:22:30 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-08-30 06:22:30 +0000
commit4b298ad77a8388f0aae62daeca66659a8effeade (patch)
tree163674f4123bf461a86b4f6fd1de964297057bae /test
parent0df79477bd2cd534ad2d89bfdbf9708c64b59eed (diff)
Use qualified names
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/lib/minitest/unit.rb2
-rw-r--r--test/monitor/test_monitor.rb2
-rw-r--r--test/ruby/lbtest.rb4
-rw-r--r--test/ruby/test_backtrace.rb4
-rw-r--r--test/ruby/test_file.rb4
-rw-r--r--test/ruby/test_regexp.rb2
-rw-r--r--test/ruby/test_thread.rb34
-rw-r--r--test/ruby/test_time.rb2
-rw-r--r--test/socket/test_unix.rb2
-rw-r--r--test/test_mutex_m.rb2
-rw-r--r--test/test_tempfile.rb4
-rw-r--r--test/test_timeout.rb2
-rw-r--r--test/thread/test_cv.rb3
-rw-r--r--test/thread/test_queue.rb3
14 files changed, 39 insertions, 31 deletions
diff --git a/test/lib/minitest/unit.rb b/test/lib/minitest/unit.rb
index aa53ef06f6e..b71e8b85b0a 100644
--- a/test/lib/minitest/unit.rb
+++ b/test/lib/minitest/unit.rb
@@ -1008,7 +1008,7 @@ module MiniTest
@report = []
@errors = @failures = @skips = 0
@verbose = false
- @mutex = defined?(Mutex) ? Mutex.new : nil
+ @mutex = Thread::Mutex.new
@info_signal = Signal.list['INFO']
end
diff --git a/test/monitor/test_monitor.rb b/test/monitor/test_monitor.rb
index 66c3e833caa..a3861735b3f 100644
--- a/test/monitor/test_monitor.rb
+++ b/test/monitor/test_monitor.rb
@@ -5,6 +5,8 @@ require "thread"
require "test/unit"
class TestMonitor < Test::Unit::TestCase
+ Queue = Thread::Queue
+
def setup
@monitor = Monitor.new
end
diff --git a/test/ruby/lbtest.rb b/test/ruby/lbtest.rb
index 591656af77e..208c8b26ecb 100644
--- a/test/ruby/lbtest.rb
+++ b/test/ruby/lbtest.rb
@@ -3,8 +3,8 @@ require 'thread'
class LocalBarrier
def initialize(n)
- @wait = Queue.new
- @done = Queue.new
+ @wait = Thread::Queue.new
+ @done = Thread::Queue.new
@keeper = begin_keeper(n)
end
diff --git a/test/ruby/test_backtrace.rb b/test/ruby/test_backtrace.rb
index b6b0f738827..ec6e0586d4b 100644
--- a/test/ruby/test_backtrace.rb
+++ b/test/ruby/test_backtrace.rb
@@ -228,7 +228,7 @@ class TestBacktrace < Test::Unit::TestCase
def test_thread_backtrace
begin
- q = Queue.new
+ q = Thread::Queue.new
th = Thread.new{
th_rec q
}
@@ -256,7 +256,7 @@ class TestBacktrace < Test::Unit::TestCase
def test_thread_backtrace_locations_with_range
begin
- q = Queue.new
+ q = Thread::Queue.new
th = Thread.new{
th_rec q
}
diff --git a/test/ruby/test_file.rb b/test/ruby/test_file.rb
index f5a00f9e17a..bd0e502f5b0 100644
--- a/test/ruby/test_file.rb
+++ b/test/ruby/test_file.rb
@@ -121,8 +121,8 @@ class TestFile < Test::Unit::TestCase
def test_truncate_size
Tempfile.create("test-truncate") do |f|
- q1 = Queue.new
- q2 = Queue.new
+ q1 = Thread::Queue.new
+ q2 = Thread::Queue.new
th = Thread.new do
data = ''
diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb
index 6cbfdb1a853..4853c41b861 100644
--- a/test/ruby/test_regexp.rb
+++ b/test/ruby/test_regexp.rb
@@ -1119,7 +1119,7 @@ class TestRegexp < Test::Unit::TestCase
end
def test_once_multithread
- m = Mutex.new
+ m = Thread::Mutex.new
pr3 = proc{|i|
/#{m.unlock; sleep 0.5; i}/o
}
diff --git a/test/ruby/test_thread.rb b/test/ruby/test_thread.rb
index d1390d2bfaf..9cb6a43cd5b 100644
--- a/test/ruby/test_thread.rb
+++ b/test/ruby/test_thread.rb
@@ -96,7 +96,7 @@ class TestThread < Test::Unit::TestCase
end
def test_mutex_synchronize
- m = Mutex.new
+ m = Thread::Mutex.new
r = 0
num_threads = 10
loop=100
@@ -120,7 +120,7 @@ class TestThread < Test::Unit::TestCase
def test_mutex_synchronize_yields_no_block_params
bug8097 = '[ruby-core:53424] [Bug #8097]'
- assert_empty(Mutex.new.synchronize {|*params| break params}, bug8097)
+ assert_empty(Thread::Mutex.new.synchronize {|*params| break params}, bug8097)
end
def test_local_barrier
@@ -346,8 +346,8 @@ class TestThread < Test::Unit::TestCase
def test_report_on_exception
assert_separately([], <<~"end;") #do
- q1 = Queue.new
- q2 = Queue.new
+ q1 = Thread::Queue.new
+ q2 = Thread::Queue.new
assert_equal(false, Thread.report_on_exception,
"global flags is false by default")
@@ -513,7 +513,7 @@ class TestThread < Test::Unit::TestCase
end
def test_mutex_deadlock
- m = Mutex.new
+ m = Thread::Mutex.new
m.synchronize do
assert_raise(ThreadError) do
m.synchronize do
@@ -524,7 +524,7 @@ class TestThread < Test::Unit::TestCase
end
def test_mutex_interrupt
- m = Mutex.new
+ m = Thread::Mutex.new
m.lock
t = Thread.new do
m.lock
@@ -536,7 +536,7 @@ class TestThread < Test::Unit::TestCase
end
def test_mutex_illegal_unlock
- m = Mutex.new
+ m = Thread::Mutex.new
m.lock
assert_raise(ThreadError) do
Thread.new do
@@ -546,8 +546,8 @@ class TestThread < Test::Unit::TestCase
end
def test_mutex_fifo_like_lock
- m1 = Mutex.new
- m2 = Mutex.new
+ m1 = Thread::Mutex.new
+ m2 = Thread::Mutex.new
m1.lock
m2.lock
m1.unlock
@@ -555,7 +555,7 @@ class TestThread < Test::Unit::TestCase
assert_equal(false, m1.locked?)
assert_equal(false, m2.locked?)
- m3 = Mutex.new
+ m3 = Thread::Mutex.new
m1.lock
m2.lock
m3.lock
@@ -568,7 +568,7 @@ class TestThread < Test::Unit::TestCase
end
def test_mutex_trylock
- m = Mutex.new
+ m = Thread::Mutex.new
assert_equal(true, m.try_lock)
assert_equal(false, m.try_lock, '[ruby-core:20943]')
@@ -753,7 +753,7 @@ class TestThread < Test::Unit::TestCase
end
def test_handle_interrupted?
- q = Queue.new
+ q = Thread::Queue.new
Thread.handle_interrupt(RuntimeError => :never){
done = false
th = Thread.new{
@@ -902,7 +902,7 @@ _eom
def test_main_thread_status_at_exit
assert_in_out_err([], <<-'INPUT', ["false false aborting"], [])
require 'thread'
-q = Queue.new
+q = Thread::Queue.new
Thread.new(Thread.current) {|mth|
begin
q.push nil
@@ -969,7 +969,7 @@ q.pop
end
def test_mutex_owned
- mutex = Mutex.new
+ mutex = Thread::Mutex.new
assert_equal(mutex.owned?, false)
mutex.synchronize {
@@ -981,7 +981,7 @@ q.pop
def test_mutex_owned2
begin
- mutex = Mutex.new
+ mutex = Thread::Mutex.new
th = Thread.new {
# lock forever
mutex.lock
@@ -998,7 +998,7 @@ q.pop
def test_mutex_unlock_on_trap
assert_in_out_err([], <<-INPUT, %w(locked unlocked false), [])
- m = Mutex.new
+ m = Thread::Mutex.new
trapped = false
Signal.trap("INT") { |signo|
@@ -1063,7 +1063,7 @@ q.pop
def test_blocking_mutex_unlocked_on_fork
bug8433 = '[ruby-core:55102] [Bug #8433]'
- mutex = Mutex.new
+ mutex = Thread::Mutex.new
flag = false
mutex.lock
diff --git a/test/ruby/test_time.rb b/test/ruby/test_time.rb
index c7d44875531..5a2ad424912 100644
--- a/test/ruby/test_time.rb
+++ b/test/ruby/test_time.rb
@@ -411,7 +411,7 @@ class TestTime < Test::Unit::TestCase
end
def test_time_interval
- m = Mutex.new.lock
+ m = Thread::Mutex.new.lock
assert_nothing_raised {
Timeout.timeout(10) {
m.sleep(0)
diff --git a/test/socket/test_unix.rb b/test/socket/test_unix.rb
index 3fe7fb368b1..7edb5e5d4f1 100644
--- a/test/socket/test_unix.rb
+++ b/test/socket/test_unix.rb
@@ -142,7 +142,7 @@ class TestSocket_UNIXSocket < Test::Unit::TestCase
r1, w = IO.pipe
s1, s2 = UNIXSocket.pair
s1.nonblock = s2.nonblock = true
- lock = Mutex.new
+ lock = Thread::Mutex.new
nr = 0
x = 2
y = 1000
diff --git a/test/test_mutex_m.rb b/test/test_mutex_m.rb
index e31c086f013..0365265b8c9 100644
--- a/test/test_mutex_m.rb
+++ b/test/test_mutex_m.rb
@@ -8,7 +8,7 @@ class TestMutexM < Test::Unit::TestCase
o = Object.new
o.instance_variable_set(:@foo, nil)
o.extend(Mutex_m)
- c = ConditionVariable.new
+ c = Thread::ConditionVariable.new
t = Thread.start {
o.synchronize do
until foo = o.instance_variable_get(:@foo)
diff --git a/test/test_tempfile.rb b/test/test_tempfile.rb
index 815c243753d..8147d93f851 100644
--- a/test/test_tempfile.rb
+++ b/test/test_tempfile.rb
@@ -246,8 +246,8 @@ puts Tempfile.new('foo').path
def test_concurrency
threads = []
tempfiles = []
- lock = Mutex.new
- cond = ConditionVariable.new
+ lock = Thread::Mutex.new
+ cond = Thread::ConditionVariable.new
start = false
4.times do
diff --git a/test/test_timeout.rb b/test/test_timeout.rb
index 94ae83e8202..1af61b7f8b4 100644
--- a/test/test_timeout.rb
+++ b/test/test_timeout.rb
@@ -5,7 +5,7 @@ require 'thread'
class TestTimeout < Test::Unit::TestCase
def test_queue
- q = Queue.new
+ q = Thread::Queue.new
assert_raise(Timeout::Error, "[ruby-dev:32935]") {
Timeout.timeout(0.01) { q.pop }
}
diff --git a/test/thread/test_cv.rb b/test/thread/test_cv.rb
index 51afb0b08ea..6779cb37ef9 100644
--- a/test/thread/test_cv.rb
+++ b/test/thread/test_cv.rb
@@ -4,6 +4,9 @@ require 'thread'
require 'tmpdir'
class TestConditionVariable < Test::Unit::TestCase
+ ConditionVariable = Thread::ConditionVariable
+ Mutex = Thread::Mutex
+
def test_initialized
assert_raise(TypeError) {
ConditionVariable.allocate.wait(nil)
diff --git a/test/thread/test_queue.rb b/test/thread/test_queue.rb
index d2ab683c0c5..cadc8e4d75f 100644
--- a/test/thread/test_queue.rb
+++ b/test/thread/test_queue.rb
@@ -5,6 +5,9 @@ require 'tmpdir'
require 'timeout'
class TestQueue < Test::Unit::TestCase
+ Queue = Thread::Queue
+ SizedQueue = Thread::SizedQueue
+
def test_queue_initialized
assert_raise(TypeError) {
Queue.allocate.push(nil)