aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_basicinstructions.rb6
-rw-r--r--test/ruby/test_beginendblock.rb6
-rw-r--r--test/ruby/test_enum.rb18
-rw-r--r--test/ruby/test_file.rb4
-rw-r--r--test/ruby/test_file_exhaustive.rb2
-rw-r--r--test/ruby/test_hash.rb6
-rw-r--r--test/ruby/test_integer.rb12
-rw-r--r--test/ruby/test_iterator.rb6
-rw-r--r--test/ruby/test_literal.rb10
-rw-r--r--test/ruby/test_proc.rb2
-rw-r--r--test/ruby/test_sprintf_comb.rb2
11 files changed, 37 insertions, 37 deletions
diff --git a/test/ruby/test_basicinstructions.rb b/test/ruby/test_basicinstructions.rb
index 36a3b2b51d..ff14e4a7a6 100644
--- a/test/ruby/test_basicinstructions.rb
+++ b/test/ruby/test_basicinstructions.rb
@@ -64,7 +64,7 @@ class TestBasicInstructions < Test::Unit::TestCase
end
def test_regexp
- assert_equal /test/, /test/
+ assert_equal(/test/, /test/)
assert_equal 'test', /test/.source
assert_equal 'TEST', /TEST/.source
assert_equal true, !!(/test/ =~ 'test')
@@ -76,9 +76,9 @@ class TestBasicInstructions < Test::Unit::TestCase
assert_equal true, !!(re =~ 'test')
assert_equal false, !!(re =~ 'does not match')
- assert_equal /x#{1+1}x/, /x#{1+1}x/
+ assert_equal(/x#{1+1}x/, /x#{1+1}x/)
s = "OK"
- assert_equal /x#{s}x/, /x#{s}x/
+ assert_equal(/x#{s}x/, /x#{s}x/)
assert_equal true, !!(/x#{s}x/ =~ "xOKx")
assert_equal false, !!(/x#{s}x/ =~ "does not match")
diff --git a/test/ruby/test_beginendblock.rb b/test/ruby/test_beginendblock.rb
index 4cfcbb01de..caed180613 100644
--- a/test/ruby/test_beginendblock.rb
+++ b/test/ruby/test_beginendblock.rb
@@ -80,8 +80,8 @@ EOW
'-e', 'raise %[SomethingElse]']) {|f|
f.read
}
- assert_match /SomethingBad/, out, "[ruby-core:9675]"
- assert_match /SomethingElse/, out, "[ruby-core:9675]"
+ assert_match(/SomethingBad/, out, "[ruby-core:9675]")
+ assert_match(/SomethingElse/, out, "[ruby-core:9675]")
end
def test_should_propagate_exit_code
@@ -99,7 +99,7 @@ EOW
'-e', 'at_exit{Process.kill(:INT, $$); loop{}}']) {|f|
f.read
}
- assert_match /Interrupt$/, out
+ assert_match(/Interrupt$/, out)
Process.kill(0, 0) rescue return # check if signal works
assert_nil $?.exitstatus
assert_equal Signal.list["INT"], $?.termsig
diff --git a/test/ruby/test_enum.rb b/test/ruby/test_enum.rb
index 4a594545e3..d252cef426 100644
--- a/test/ruby/test_enum.rb
+++ b/test/ruby/test_enum.rb
@@ -143,27 +143,27 @@ class TestEnumerable < Test::Unit::TestCase
def test_min
assert_equal(1, @obj.min)
assert_equal(3, @obj.min {|a,b| b <=> a })
- a = %w(albatross dog horse)
- assert_equal("albatross", a.min)
- assert_equal("dog", a.min {|a,b| a.length <=> b.length })
+ ary = %w(albatross dog horse)
+ assert_equal("albatross", ary.min)
+ assert_equal("dog", ary.min {|a,b| a.length <=> b.length })
assert_equal(1, [3,2,1].min)
end
def test_max
assert_equal(3, @obj.max)
assert_equal(1, @obj.max {|a,b| b <=> a })
- a = %w(albatross dog horse)
- assert_equal("horse", a.max)
- assert_equal("albatross", a.max {|a,b| a.length <=> b.length })
+ ary = %w(albatross dog horse)
+ assert_equal("horse", ary.max)
+ assert_equal("albatross", ary.max {|a,b| a.length <=> b.length })
assert_equal(1, [3,2,1].max{|a,b| b <=> a })
end
def test_minmax
assert_equal([1, 3], @obj.minmax)
assert_equal([3, 1], @obj.minmax {|a,b| b <=> a })
- a = %w(albatross dog horse)
- assert_equal(["albatross", "horse"], a.minmax)
- assert_equal(["dog", "albatross"], a.minmax {|a,b| a.length <=> b.length })
+ ary = %w(albatross dog horse)
+ assert_equal(["albatross", "horse"], ary.minmax)
+ assert_equal(["dog", "albatross"], ary.minmax {|a,b| a.length <=> b.length })
assert_equal([1, 3], [2,3,1].minmax)
assert_equal([3, 1], [2,3,1].minmax {|a,b| b <=> a })
assert_equal([1, 3], [2,2,3,3,1,1].minmax)
diff --git a/test/ruby/test_file.rb b/test/ruby/test_file.rb
index b4666ad4a6..b8ba9a4b19 100644
--- a/test/ruby/test_file.rb
+++ b/test/ruby/test_file.rb
@@ -140,13 +140,13 @@ class TestFile < Test::Unit::TestCase
end
def test_s_chown
- assert_nothing_raised { File.chown -1, -1 }
+ assert_nothing_raised { File.chown(-1, -1) }
assert_nothing_raised { File.chown nil, nil }
end
def test_chown
assert_nothing_raised {
- File.open(__FILE__) {|f| f.chown -1, -1 }
+ File.open(__FILE__) {|f| f.chown(-1, -1) }
}
assert_nothing_raised("[ruby-dev:27140]") {
File.open(__FILE__) {|f| f.chown nil, nil }
diff --git a/test/ruby/test_file_exhaustive.rb b/test/ruby/test_file_exhaustive.rb
index e7d60960b8..74b960c54f 100644
--- a/test/ruby/test_file_exhaustive.rb
+++ b/test/ruby/test_file_exhaustive.rb
@@ -492,7 +492,7 @@ class TestFileExhaustive < Test::Unit::TestCase
f.close
make_file("foo", @file)
- assert_raise(IOError) { File.open(@file) {|f| f.truncate(0)} }
+ assert_raise(IOError) { File.open(@file) {|ff| ff.truncate(0)} }
rescue NotImplementedError
end
diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb
index d03783129f..5c9b08b917 100644
--- a/test/ruby/test_hash.rb
+++ b/test/ruby/test_hash.rb
@@ -51,7 +51,7 @@ class TestHash < Test::Unit::TestCase
assert_equal([], x[22])
assert_not_same(x[22], x[22])
- x = Hash.new{|h,k| z = k; h[k] = k*2}
+ x = Hash.new{|h,kk| z = kk; h[kk] = kk*2}
z = 0
assert_equal(44, x[22])
assert_equal(22, z)
@@ -703,14 +703,14 @@ class TestHash < Test::Unit::TestCase
end
def test_default_proc
- h = Hash.new {|h, k| h + k + "baz" }
+ h = Hash.new {|hh, k| hh + k + "baz" }
assert_equal("foobarbaz", h.default_proc.call("foo", "bar"))
h = {}
assert_nil(h.default_proc)
end
def test_shift2
- h = Hash.new {|h, k| :foo }
+ h = Hash.new {|hh, k| :foo }
h[1] = 2
assert_equal([1, 2], h.shift)
assert_equal(:foo, h.shift)
diff --git a/test/ruby/test_integer.rb b/test/ruby/test_integer.rb
index 840192c5ad..7f8212ebf0 100644
--- a/test/ruby/test_integer.rb
+++ b/test/ruby/test_integer.rb
@@ -150,10 +150,10 @@ class TestInteger < Test::Unit::TestCase
1.upto(0) {|x| a << x }
assert_equal([], a)
- x = 2**30 - 1
+ y = 2**30 - 1
a = []
- x.upto(x+2) {|x| a << x }
- assert_equal([x, x+1, x+2], a)
+ y.upto(y+2) {|x| a << x }
+ assert_equal([y, y+1, y+2], a)
end
def test_downto
@@ -165,10 +165,10 @@ class TestInteger < Test::Unit::TestCase
1.downto(2) {|x| a << x }
assert_equal([], a)
- x = -(2**30)
+ y = -(2**30)
a = []
- x.downto(x-2) {|x| a << x }
- assert_equal([x, x-1, x-2], a)
+ y.downto(y-2) {|x| a << x }
+ assert_equal([y, y-1, y-2], a)
end
def test_times
diff --git a/test/ruby/test_iterator.rb b/test/ruby/test_iterator.rb
index ca6022a4fb..42e3960e72 100644
--- a/test/ruby/test_iterator.rb
+++ b/test/ruby/test_iterator.rb
@@ -5,8 +5,8 @@ class Array
collect{|e| [e, yield(e)]}.sort{|a,b|a[1]<=>b[1]}
end
def iter_test2
- a = collect{|e| [e, yield(e)]}
- a.sort{|a,b|a[1]<=>b[1]}
+ ary = collect{|e| [e, yield(e)]}
+ ary.sort{|a,b|a[1]<=>b[1]}
end
end
@@ -51,7 +51,7 @@ class TestIterator < Test::Unit::TestCase
def test_nested_iterator
i = 0
- tt{|i| break if i == 5}
+ tt{|j| break if j == 5}
assert_equal(0, i)
assert_raise(ArgumentError) do
diff --git a/test/ruby/test_literal.rb b/test/ruby/test_literal.rb
index e251197c79..80c8af9312 100644
--- a/test/ruby/test_literal.rb
+++ b/test/ruby/test_literal.rb
@@ -77,16 +77,16 @@ class TestRubyLiteral < Test::Unit::TestCase
def test_regexp
assert_instance_of Regexp, //
- assert_match //, 'a'
- assert_match //, ''
+ assert_match(//, 'a')
+ assert_match(//, '')
assert_instance_of Regexp, /a/
- assert_match /a/, 'a'
- assert_no_match /test/, 'tes'
+ assert_match(/a/, 'a')
+ assert_no_match(/test/, 'tes')
re = /test/
assert_match re, 'test'
str = 'test'
assert_match re, str
- assert_match /test/, str
+ assert_match(/test/, str)
assert_equal 0, (/test/ =~ 'test')
assert_equal 0, (re =~ 'test')
assert_equal 0, (/test/ =~ str)
diff --git a/test/ruby/test_proc.rb b/test/ruby/test_proc.rb
index 6b8fb974ee..213566903e 100644
--- a/test/ruby/test_proc.rb
+++ b/test/ruby/test_proc.rb
@@ -178,7 +178,7 @@ class TestProc < Test::Unit::TestCase
b = proc { :foo }
assert_equal(:foo, b.curry[])
- b = lambda {|x, y, &b| b.call(x + y) }.curry
+ b = lambda {|x, y, &blk| blk.call(x + y) }.curry
b = b.call(2) { raise }
b = b.call(3) {|x| x + 4 }
assert_equal(9, b)
diff --git a/test/ruby/test_sprintf_comb.rb b/test/ruby/test_sprintf_comb.rb
index 5dee7305fb..261732bcbc 100644
--- a/test/ruby/test_sprintf_comb.rb
+++ b/test/ruby/test_sprintf_comb.rb
@@ -229,7 +229,7 @@ class TestSprintfComb < Test::Unit::TestCase
digits.reverse!
- str = digits.map {|d| digitmap[d] }.join
+ str = digits.map {|digit| digitmap[digit] }.join
pad = ''
nlen = prefix.length + sign.length + str.length