Skip to content

Commit 409b0ec

Browse files
committed
Suppress unused variable warnings
1 parent 84837e6 commit 409b0ec

16 files changed

+25
-8
lines changed

test/net/ftp/test_ftp.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,7 @@ def test_list_fail
530530
sock.print("553 Requested action not taken.\r\n")
531531
commands.push(sock.gets)
532532
sock.print("200 Switching to Binary mode.\r\n")
533+
[host, port]
533534
}
534535
begin
535536
begin
@@ -711,6 +712,7 @@ def test_retrbinary_fail
711712
host, port = process_port_or_eprt(sock, line)
712713
commands.push(sock.gets)
713714
sock.print("550 Requested action not taken.\r\n")
715+
[host, port]
714716
}
715717
begin
716718
begin
@@ -937,6 +939,7 @@ def test_storbinary_fail
937939
host, port = process_port_or_eprt(sock, line)
938940
commands.push(sock.gets)
939941
sock.print("452 Requested file action aborted.\r\n")
942+
[host, port]
940943
}
941944
begin
942945
begin

test/objspace/test_objspace.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def test_count_imemo_objects
106106
end
107107

108108
def test_memsize_of_iseq
109-
iseqw = RubyVM::InstructionSequence.compile('def a; a = :b; end')
109+
iseqw = RubyVM::InstructionSequence.compile('def a; a = :b; a; end')
110110
base_obj_size = ObjectSpace.memsize_of(Object.new)
111111
assert_operator(ObjectSpace.memsize_of(iseqw), :>, base_obj_size)
112112
end

test/ruby/test_ast.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,9 @@ def test_of
205205
end
206206

207207
def test_scope_local_variables
208-
node = RubyVM::AbstractSyntaxTree.parse("x = 0")
208+
node = RubyVM::AbstractSyntaxTree.parse("_x = 0")
209209
lv, _, body = *node.children
210-
assert_equal([:x], lv)
210+
assert_equal([:_x], lv)
211211
assert_equal(:LASGN, body.type)
212212
end
213213

test/ruby/test_eval.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,7 @@ module EvTest
345345
# assert_equal(1, eval("foo11"))
346346
assert_equal(eval("foo22"), eval("foo22", p))
347347
assert_equal(55, eval("foo22"))
348+
assert_equal(55, foo22)
348349
}.call
349350
end
350351

test/ruby/test_flip.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def test_hidden_key
2929
assert_nothing_raised(NotImplementedError, bug6899) do
3030
2000.times {eval %[(foo..bar) ? 1 : 2]}
3131
end
32-
foo = bar
32+
[foo, bar]
3333
end
3434

3535
def test_shared_eval
@@ -38,6 +38,7 @@ def test_shared_eval
3838
eval("vs.select {|n| if n==2..n==16 then 1 end}")
3939
v = eval("vs.select {|n| if n==3..n==6 then 1 end}")
4040
assert_equal([*3..6], v, bug7671)
41+
vs
4142
end
4243

4344
def test_shared_thread

test/ruby/test_gc.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ def test_gc
1717
1.upto(10000) {
1818
tmp = [0,1,2,3,4,5,6,7,8,9]
1919
}
20+
tmp
2021
end
2122
l=nil
2223
100000.times {

test/ruby/test_gc_compact.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ def test_many_collisions
119119
collisions = GC.stat(:object_id_collisions)
120120
skip "couldn't get objects to collide" if collisions == 0
121121
assert_operator collisions, :>, 0
122+
ids.clear
123+
new_tenants.clear
122124
end
123125

124126
def test_complex_hash_keys

test/ruby/test_iseq.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ class A
452452
class B
453453
2.times {
454454
def self.foo
455-
a = 'good day'
455+
_a = 'good day'
456456
raise
457457
rescue
458458
'dear reader'

test/ruby/test_literal.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def test_frozen_string_in_array_literal
187187
if defined?(RubyVM::InstructionSequence.compile_option) and
188188
RubyVM::InstructionSequence.compile_option.key?(:debug_frozen_string_literal)
189189
def test_debug_frozen_string
190-
src = 'n = 1; "foo#{n ? "-#{n}" : ""}"'; f = "test.rb"; n = 1
190+
src = 'n = 1; _="foo#{n ? "-#{n}" : ""}"'; f = "test.rb"; n = 1
191191
opt = {frozen_string_literal: true, debug_frozen_string_literal: true}
192192
str = RubyVM::InstructionSequence.compile(src, f, f, n, opt).eval
193193
assert_equal("foo-1", str)

test/ruby/test_m17n.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,8 @@ def test_regexp_embed
615615
r1 = Regexp.new('\xa1'.force_encoding("ascii-8bit"))
616616
r2 = eval('/\xa1#{r1}/'.force_encoding('ascii-8bit'))
617617
assert_equal(Encoding::ASCII_8BIT, r2.encoding)
618+
619+
[r1, r2]
618620
end
619621

620622
def test_regexp_named_class

0 commit comments

Comments
 (0)