Suppress unused variable warnings
This commit is contained in:
parent
84837e6d16
commit
409b0ec4c3
@ -530,6 +530,7 @@ class FTPTest < Test::Unit::TestCase
|
|||||||
sock.print("553 Requested action not taken.\r\n")
|
sock.print("553 Requested action not taken.\r\n")
|
||||||
commands.push(sock.gets)
|
commands.push(sock.gets)
|
||||||
sock.print("200 Switching to Binary mode.\r\n")
|
sock.print("200 Switching to Binary mode.\r\n")
|
||||||
|
[host, port]
|
||||||
}
|
}
|
||||||
begin
|
begin
|
||||||
begin
|
begin
|
||||||
@ -711,6 +712,7 @@ class FTPTest < Test::Unit::TestCase
|
|||||||
host, port = process_port_or_eprt(sock, line)
|
host, port = process_port_or_eprt(sock, line)
|
||||||
commands.push(sock.gets)
|
commands.push(sock.gets)
|
||||||
sock.print("550 Requested action not taken.\r\n")
|
sock.print("550 Requested action not taken.\r\n")
|
||||||
|
[host, port]
|
||||||
}
|
}
|
||||||
begin
|
begin
|
||||||
begin
|
begin
|
||||||
@ -937,6 +939,7 @@ class FTPTest < Test::Unit::TestCase
|
|||||||
host, port = process_port_or_eprt(sock, line)
|
host, port = process_port_or_eprt(sock, line)
|
||||||
commands.push(sock.gets)
|
commands.push(sock.gets)
|
||||||
sock.print("452 Requested file action aborted.\r\n")
|
sock.print("452 Requested file action aborted.\r\n")
|
||||||
|
[host, port]
|
||||||
}
|
}
|
||||||
begin
|
begin
|
||||||
begin
|
begin
|
||||||
|
@ -106,7 +106,7 @@ class TestObjSpace < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_memsize_of_iseq
|
def test_memsize_of_iseq
|
||||||
iseqw = RubyVM::InstructionSequence.compile('def a; a = :b; end')
|
iseqw = RubyVM::InstructionSequence.compile('def a; a = :b; a; end')
|
||||||
base_obj_size = ObjectSpace.memsize_of(Object.new)
|
base_obj_size = ObjectSpace.memsize_of(Object.new)
|
||||||
assert_operator(ObjectSpace.memsize_of(iseqw), :>, base_obj_size)
|
assert_operator(ObjectSpace.memsize_of(iseqw), :>, base_obj_size)
|
||||||
end
|
end
|
||||||
|
@ -205,9 +205,9 @@ class TestAst < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_scope_local_variables
|
def test_scope_local_variables
|
||||||
node = RubyVM::AbstractSyntaxTree.parse("x = 0")
|
node = RubyVM::AbstractSyntaxTree.parse("_x = 0")
|
||||||
lv, _, body = *node.children
|
lv, _, body = *node.children
|
||||||
assert_equal([:x], lv)
|
assert_equal([:_x], lv)
|
||||||
assert_equal(:LASGN, body.type)
|
assert_equal(:LASGN, body.type)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -345,6 +345,7 @@ class TestEval < Test::Unit::TestCase
|
|||||||
# assert_equal(1, eval("foo11"))
|
# assert_equal(1, eval("foo11"))
|
||||||
assert_equal(eval("foo22"), eval("foo22", p))
|
assert_equal(eval("foo22"), eval("foo22", p))
|
||||||
assert_equal(55, eval("foo22"))
|
assert_equal(55, eval("foo22"))
|
||||||
|
assert_equal(55, foo22)
|
||||||
}.call
|
}.call
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ class TestFlip < Test::Unit::TestCase
|
|||||||
assert_nothing_raised(NotImplementedError, bug6899) do
|
assert_nothing_raised(NotImplementedError, bug6899) do
|
||||||
2000.times {eval %[(foo..bar) ? 1 : 2]}
|
2000.times {eval %[(foo..bar) ? 1 : 2]}
|
||||||
end
|
end
|
||||||
foo = bar
|
[foo, bar]
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_shared_eval
|
def test_shared_eval
|
||||||
@ -38,6 +38,7 @@ class TestFlip < Test::Unit::TestCase
|
|||||||
eval("vs.select {|n| if n==2..n==16 then 1 end}")
|
eval("vs.select {|n| if n==2..n==16 then 1 end}")
|
||||||
v = eval("vs.select {|n| if n==3..n==6 then 1 end}")
|
v = eval("vs.select {|n| if n==3..n==6 then 1 end}")
|
||||||
assert_equal([*3..6], v, bug7671)
|
assert_equal([*3..6], v, bug7671)
|
||||||
|
vs
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_shared_thread
|
def test_shared_thread
|
||||||
|
@ -17,6 +17,7 @@ class TestGc < Test::Unit::TestCase
|
|||||||
1.upto(10000) {
|
1.upto(10000) {
|
||||||
tmp = [0,1,2,3,4,5,6,7,8,9]
|
tmp = [0,1,2,3,4,5,6,7,8,9]
|
||||||
}
|
}
|
||||||
|
tmp
|
||||||
end
|
end
|
||||||
l=nil
|
l=nil
|
||||||
100000.times {
|
100000.times {
|
||||||
|
@ -119,6 +119,8 @@ class TestGCCompact < Test::Unit::TestCase
|
|||||||
collisions = GC.stat(:object_id_collisions)
|
collisions = GC.stat(:object_id_collisions)
|
||||||
skip "couldn't get objects to collide" if collisions == 0
|
skip "couldn't get objects to collide" if collisions == 0
|
||||||
assert_operator collisions, :>, 0
|
assert_operator collisions, :>, 0
|
||||||
|
ids.clear
|
||||||
|
new_tenants.clear
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_complex_hash_keys
|
def test_complex_hash_keys
|
||||||
|
@ -452,7 +452,7 @@ class TestISeq < Test::Unit::TestCase
|
|||||||
class B
|
class B
|
||||||
2.times {
|
2.times {
|
||||||
def self.foo
|
def self.foo
|
||||||
a = 'good day'
|
_a = 'good day'
|
||||||
raise
|
raise
|
||||||
rescue
|
rescue
|
||||||
'dear reader'
|
'dear reader'
|
||||||
|
@ -187,7 +187,7 @@ class TestRubyLiteral < Test::Unit::TestCase
|
|||||||
if defined?(RubyVM::InstructionSequence.compile_option) and
|
if defined?(RubyVM::InstructionSequence.compile_option) and
|
||||||
RubyVM::InstructionSequence.compile_option.key?(:debug_frozen_string_literal)
|
RubyVM::InstructionSequence.compile_option.key?(:debug_frozen_string_literal)
|
||||||
def test_debug_frozen_string
|
def test_debug_frozen_string
|
||||||
src = 'n = 1; "foo#{n ? "-#{n}" : ""}"'; f = "test.rb"; n = 1
|
src = 'n = 1; _="foo#{n ? "-#{n}" : ""}"'; f = "test.rb"; n = 1
|
||||||
opt = {frozen_string_literal: true, debug_frozen_string_literal: true}
|
opt = {frozen_string_literal: true, debug_frozen_string_literal: true}
|
||||||
str = RubyVM::InstructionSequence.compile(src, f, f, n, opt).eval
|
str = RubyVM::InstructionSequence.compile(src, f, f, n, opt).eval
|
||||||
assert_equal("foo-1", str)
|
assert_equal("foo-1", str)
|
||||||
|
@ -615,6 +615,8 @@ class TestM17N < Test::Unit::TestCase
|
|||||||
r1 = Regexp.new('\xa1'.force_encoding("ascii-8bit"))
|
r1 = Regexp.new('\xa1'.force_encoding("ascii-8bit"))
|
||||||
r2 = eval('/\xa1#{r1}/'.force_encoding('ascii-8bit'))
|
r2 = eval('/\xa1#{r1}/'.force_encoding('ascii-8bit'))
|
||||||
assert_equal(Encoding::ASCII_8BIT, r2.encoding)
|
assert_equal(Encoding::ASCII_8BIT, r2.encoding)
|
||||||
|
|
||||||
|
[r1, r2]
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_regexp_named_class
|
def test_regexp_named_class
|
||||||
|
@ -751,6 +751,7 @@ class TestRubyOptimization < Test::Unit::TestCase
|
|||||||
h = {}
|
h = {}
|
||||||
assert_equal(bug, eval('{ok: 42, **h}; bug'))
|
assert_equal(bug, eval('{ok: 42, **h}; bug'))
|
||||||
assert_equal(:ok, eval('{ok: bug = :ok, **h}; bug'))
|
assert_equal(:ok, eval('{ok: bug = :ok, **h}; bug'))
|
||||||
|
assert_empty(h)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_overwritten_blockparam
|
def test_overwritten_blockparam
|
||||||
|
@ -481,6 +481,7 @@ class TestParse < Test::Unit::TestCase
|
|||||||
t[42, &blk] ||= t.dummy 42 # command_asgn test
|
t[42, &blk] ||= t.dummy 42 # command_asgn test
|
||||||
END
|
END
|
||||||
assert_equal([:aref, :aset], a)
|
assert_equal([:aref, :aset], a)
|
||||||
|
blk
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_backquote
|
def test_backquote
|
||||||
@ -1148,7 +1149,7 @@ x = __ENCODING__
|
|||||||
end
|
end
|
||||||
o.instance_eval {i (-1.3).abs}
|
o.instance_eval {i (-1.3).abs}
|
||||||
assert_equal(1.3, o.x)
|
assert_equal(1.3, o.x)
|
||||||
o.instance_eval {i = 0; i (-1.3).abs}
|
o.instance_eval {i = 0; i (-1.3).abs; i}
|
||||||
assert_equal(1.3, o.x)
|
assert_equal(1.3, o.x)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1157,6 +1158,7 @@ x = __ENCODING__
|
|||||||
$VERBOSE = true
|
$VERBOSE = true
|
||||||
x = 1
|
x = 1
|
||||||
eval("if false; 0 < x < 2; end")
|
eval("if false; 0 < x < 2; end")
|
||||||
|
x
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1302,7 +1302,7 @@ class TestProc < Test::Unit::TestCase
|
|||||||
def test_local_variables
|
def test_local_variables
|
||||||
b = get_binding
|
b = get_binding
|
||||||
assert_equal(%i'if case when begin end a', b.local_variables)
|
assert_equal(%i'if case when begin end a', b.local_variables)
|
||||||
a = tap {|;x, y| x = y; break binding.local_variables}
|
a = tap {|;x, y| x = y = x; break binding.local_variables}
|
||||||
assert_equal(%i[a b x y], a.sort)
|
assert_equal(%i[a b x y], a.sort)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1562,6 +1562,7 @@ class TestRefinement < Test::Unit::TestCase
|
|||||||
undef :foo
|
undef :foo
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
ext
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_call_refined_method_in_duplicate_module
|
def test_call_refined_method_in_duplicate_module
|
||||||
@ -2291,6 +2292,7 @@ class TestRefinement < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
assert_equal("[C[A[B]]]", c.new.foo, '[ruby-dev:50390] [Bug #14232]')
|
assert_equal("[C[A[B]]]", c.new.foo, '[ruby-dev:50390] [Bug #14232]')
|
||||||
|
d
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
@ -736,6 +736,7 @@ class TestSocket < Test::Unit::TestCase
|
|||||||
ret, addr, rflags = s1.recvmsg(10, 0)
|
ret, addr, rflags = s1.recvmsg(10, 0)
|
||||||
assert_equal "b" * 10, ret
|
assert_equal "b" * 10, ret
|
||||||
assert_equal Socket::MSG_TRUNC, rflags & Socket::MSG_TRUNC if !rflags.nil?
|
assert_equal Socket::MSG_TRUNC, rflags & Socket::MSG_TRUNC if !rflags.nil?
|
||||||
|
addr
|
||||||
ensure
|
ensure
|
||||||
s1.close
|
s1.close
|
||||||
s2.close
|
s2.close
|
||||||
|
@ -320,5 +320,6 @@ class TestOpen3 < Test::Unit::TestCase
|
|||||||
command = [RUBY, '-e', 'puts "test_integer_and_symbol_key"']
|
command = [RUBY, '-e', 'puts "test_integer_and_symbol_key"']
|
||||||
out, status = Open3.capture2(*command, :chdir => '.', 2 => IO::NULL)
|
out, status = Open3.capture2(*command, :chdir => '.', 2 => IO::NULL)
|
||||||
assert_equal("test_integer_and_symbol_key\n", out)
|
assert_equal("test_integer_and_symbol_key\n", out)
|
||||||
|
assert_predicate(status, :success?)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user