mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/ruby: get rid of warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45273 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
01740f0c27
commit
9194b220a5
13 changed files with 20 additions and 23 deletions
|
@ -91,7 +91,7 @@ class TestLambdaParameters < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def return_in_current(val)
|
def return_in_current(val)
|
||||||
1.tap &->(*) {return 0}
|
1.tap(&->(*) {return 0})
|
||||||
val
|
val
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ class TestLambdaParameters < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def return_in_callee(val)
|
def return_in_callee(val)
|
||||||
yield_block &->(*) {return 0}
|
yield_block(&->(*) {return 0})
|
||||||
val
|
val
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -313,11 +313,11 @@ class TestLazyEnumerator < Test::Unit::TestCase
|
||||||
def test_take_rewound
|
def test_take_rewound
|
||||||
bug7696 = '[ruby-core:51470]'
|
bug7696 = '[ruby-core:51470]'
|
||||||
e=(1..42).lazy.take(2)
|
e=(1..42).lazy.take(2)
|
||||||
assert_equal 1, e.next
|
assert_equal 1, e.next, bug7696
|
||||||
assert_equal 2, e.next
|
assert_equal 2, e.next, bug7696
|
||||||
e.rewind
|
e.rewind
|
||||||
assert_equal 1, e.next
|
assert_equal 1, e.next, bug7696
|
||||||
assert_equal 2, e.next
|
assert_equal 2, e.next, bug7696
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_take_while
|
def test_take_while
|
||||||
|
|
|
@ -1258,7 +1258,7 @@ class TestModule < Test::Unit::TestCase
|
||||||
c = Class.new do
|
c = Class.new do
|
||||||
attr_writer :foo
|
attr_writer :foo
|
||||||
end
|
end
|
||||||
assert_raise(ArgumentError) { c.new.send :foo= }
|
assert_raise(ArgumentError, bug8540) { c.new.send :foo= }
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_private_constant
|
def test_private_constant
|
||||||
|
|
|
@ -801,7 +801,7 @@ class TestObject < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_type_error_message
|
def test_type_error_message
|
||||||
issue = "Bug #7539"
|
_issue = "Bug #7539"
|
||||||
assert_raise_with_message(TypeError, "can't convert Array into Integer") {Integer([42])}
|
assert_raise_with_message(TypeError, "can't convert Array into Integer") {Integer([42])}
|
||||||
assert_raise_with_message(TypeError, 'no implicit conversion of Array into Integer') {[].first([42])}
|
assert_raise_with_message(TypeError, 'no implicit conversion of Array into Integer') {[].first([42])}
|
||||||
end
|
end
|
||||||
|
|
|
@ -163,7 +163,7 @@ class TestRubyOptimization < Test::Unit::TestCase
|
||||||
tailcall_optimization: true,
|
tailcall_optimization: true,
|
||||||
trace_instruction: false,
|
trace_instruction: false,
|
||||||
}
|
}
|
||||||
iseq = RubyVM::InstructionSequence.new(<<-EOF, "Bug#4082", bug4082, nil, option).eval
|
RubyVM::InstructionSequence.new(<<-EOF, "Bug#4082", bug4082, nil, option).eval
|
||||||
class #{self.class}::Tailcall
|
class #{self.class}::Tailcall
|
||||||
def fact_helper(n, res)
|
def fact_helper(n, res)
|
||||||
if n == 1
|
if n == 1
|
||||||
|
@ -187,7 +187,7 @@ class TestRubyOptimization < Test::Unit::TestCase
|
||||||
tailcall_optimization: true,
|
tailcall_optimization: true,
|
||||||
trace_instruction: false,
|
trace_instruction: false,
|
||||||
}
|
}
|
||||||
iseq = RubyVM::InstructionSequence.new(<<-EOF, "Bug#6901", bug6901, nil, option).eval
|
RubyVM::InstructionSequence.new(<<-EOF, "Bug#6901", bug6901, nil, option).eval
|
||||||
def identity(val)
|
def identity(val)
|
||||||
val
|
val
|
||||||
end
|
end
|
||||||
|
|
|
@ -218,7 +218,6 @@ class TestParse < Test::Unit::TestCase
|
||||||
def o.>(x); x; end
|
def o.>(x); x; end
|
||||||
def o./(x); x; end
|
def o./(x); x; end
|
||||||
|
|
||||||
a = nil
|
|
||||||
assert_nothing_raised do
|
assert_nothing_raised do
|
||||||
o.instance_eval <<-END, __FILE__, __LINE__+1
|
o.instance_eval <<-END, __FILE__, __LINE__+1
|
||||||
undef >, /
|
undef >, /
|
||||||
|
|
|
@ -210,7 +210,8 @@ class TestRand < Test::Unit::TestCase
|
||||||
assert_raise(ArgumentError, '[ruby-dev:39166]') { r.rand(0..-1) }
|
assert_raise(ArgumentError, '[ruby-dev:39166]') { r.rand(0..-1) }
|
||||||
assert_raise(ArgumentError, '[ruby-dev:39166]') { r.rand(0.0...0.0) }
|
assert_raise(ArgumentError, '[ruby-dev:39166]') { r.rand(0.0...0.0) }
|
||||||
assert_raise(ArgumentError, '[ruby-dev:39166]') { r.rand(0.0...-0.1) }
|
assert_raise(ArgumentError, '[ruby-dev:39166]') { r.rand(0.0...-0.1) }
|
||||||
assert_raise(ArgumentError, bug3027 = '[ruby-core:29075]') { r.rand(nil) }
|
bug3027 = '[ruby-core:29075]'
|
||||||
|
assert_raise(ArgumentError, bug3027) { r.rand(nil) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_random_seed
|
def test_random_seed
|
||||||
|
@ -420,7 +421,7 @@ END
|
||||||
(1..10).to_a.shuffle
|
(1..10).to_a.shuffle
|
||||||
raise 'default seed is not set' if srand == 0
|
raise 'default seed is not set' if srand == 0
|
||||||
end
|
end
|
||||||
p2, st = Process.waitpid2(pid)
|
_, st = Process.waitpid2(pid)
|
||||||
assert_predicate(st, :success?, "#{st.inspect}")
|
assert_predicate(st, :success?, "#{st.inspect}")
|
||||||
rescue NotImplementedError, ArgumentError
|
rescue NotImplementedError, ArgumentError
|
||||||
end
|
end
|
||||||
|
|
|
@ -259,7 +259,7 @@ class TestRefinement < Test::Unit::TestCase
|
||||||
def test_return_value_of_refine
|
def test_return_value_of_refine
|
||||||
mod = nil
|
mod = nil
|
||||||
result = nil
|
result = nil
|
||||||
m = Module.new {
|
Module.new {
|
||||||
result = refine(Object) {
|
result = refine(Object) {
|
||||||
mod = self
|
mod = self
|
||||||
}
|
}
|
||||||
|
@ -433,7 +433,6 @@ class TestRefinement < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_module_using_class
|
def test_module_using_class
|
||||||
c = Class.new
|
|
||||||
assert_raise(TypeError) do
|
assert_raise(TypeError) do
|
||||||
eval("using TestRefinement::UsingClass", TOPLEVEL_BINDING)
|
eval("using TestRefinement::UsingClass", TOPLEVEL_BINDING)
|
||||||
end
|
end
|
||||||
|
|
|
@ -194,7 +194,7 @@ class TestSuper < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
overlaid.call(str = "123")
|
overlaid.call(str = "123")
|
||||||
overlaid.call(ary = [1,2,3])
|
overlaid.call([1,2,3])
|
||||||
str.reverse
|
str.reverse
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -318,7 +318,6 @@ class TestSuper < Test::Unit::TestCase
|
||||||
}
|
}
|
||||||
sub_class = Class.new(super_class) {
|
sub_class = Class.new(super_class) {
|
||||||
def foo
|
def foo
|
||||||
x = Object.new
|
|
||||||
lambda { super() }
|
lambda { super() }
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ class TestSystem < Test::Unit::TestCase
|
||||||
File.unlink tmpfilename
|
File.unlink tmpfilename
|
||||||
|
|
||||||
testname = '[ruby-core:44505]'
|
testname = '[ruby-core:44505]'
|
||||||
assert_match /Windows/, `ver`, testname
|
assert_match(/Windows/, `ver`, testname)
|
||||||
assert_equal 0, $?.to_i, testname
|
assert_equal 0, $?.to_i, testname
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
|
@ -511,8 +511,8 @@ class TestThread < Test::Unit::TestCase
|
||||||
def test_no_valid_cfp
|
def test_no_valid_cfp
|
||||||
skip 'with win32ole, cannot run this testcase because win32ole redefines Thread#intialize' if defined?(WIN32OLE)
|
skip 'with win32ole, cannot run this testcase because win32ole redefines Thread#intialize' if defined?(WIN32OLE)
|
||||||
bug5083 = '[ruby-dev:44208]'
|
bug5083 = '[ruby-dev:44208]'
|
||||||
assert_equal([], Thread.new(&Module.method(:nesting)).value)
|
assert_equal([], Thread.new(&Module.method(:nesting)).value, bug5083)
|
||||||
assert_instance_of(Thread, Thread.new(:to_s, &Class.new.method(:undef_method)).join)
|
assert_instance_of(Thread, Thread.new(:to_s, &Class.new.method(:undef_method)).join, bug5083)
|
||||||
end
|
end
|
||||||
|
|
||||||
def make_handle_interrupt_test_thread1 flag
|
def make_handle_interrupt_test_thread1 flag
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
require 'rational'
|
|
||||||
require 'delegate'
|
require 'delegate'
|
||||||
require 'timeout'
|
require 'timeout'
|
||||||
require 'delegate'
|
require 'delegate'
|
||||||
|
|
|
@ -150,7 +150,7 @@ class TestTimeTZ < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_europe_lisbon
|
def test_europe_lisbon
|
||||||
with_tz(tz="Europe/Lisbon") {
|
with_tz("Europe/Lisbon") {
|
||||||
assert_equal("LMT", Time.new(-0x1_0000_0000_0000_0000).zone)
|
assert_equal("LMT", Time.new(-0x1_0000_0000_0000_0000).zone)
|
||||||
}
|
}
|
||||||
end if has_right_tz
|
end if has_right_tz
|
||||||
|
@ -250,7 +250,7 @@ class TestTimeTZ < Test::Unit::TestCase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
group_by(sample) {|tz, _, _, _| tz }.each {|tz, a|
|
group_by(sample) {|tz, _, _, _| tz }.each {|tz, a|
|
||||||
a.each_with_index {|(_, u, l, gmtoff), i|
|
a.each_with_index {|(_, _, l, gmtoff), i|
|
||||||
expected = "%04d-%02d-%02d %02d:%02d:%02d %s" % (l+[format_gmtoff(gmtoff)])
|
expected = "%04d-%02d-%02d %02d:%02d:%02d %s" % (l+[format_gmtoff(gmtoff)])
|
||||||
monotonic_to_past = i == 0 || (a[i-1][2] <=> l) < 0
|
monotonic_to_past = i == 0 || (a[i-1][2] <=> l) < 0
|
||||||
monotonic_to_future = i == a.length-1 || (l <=> a[i+1][2]) < 0
|
monotonic_to_future = i == a.length-1 || (l <=> a[i+1][2]) < 0
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue