summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-07-25 06:49:35 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-07-25 06:49:35 +0000
commit131f694330d1d44add74643a264ff7c4d7f06216 (patch)
treefdaf9a9df3b7bb7054310eb4a751f261210df3c0 /test
parentc5581959992c3fd621b48f9fc506454993daf077 (diff)
Suppress warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/gdbm/test_gdbm.rb10
-rw-r--r--test/ruby/test_econv.rb30
-rw-r--r--test/test_securerandom.rb8
3 files changed, 27 insertions, 21 deletions
diff --git a/test/gdbm/test_gdbm.rb b/test/gdbm/test_gdbm.rb
index 621101c..38d97c1 100644
--- a/test/gdbm/test_gdbm.rb
+++ b/test/gdbm/test_gdbm.rb
@@ -147,14 +147,14 @@ if defined? GDBM
def test_s_open_lock
return unless have_fork? # snip this test
pid = fork() {
- assert_instance_of(GDBM, gdbm = GDBM.open("#{@tmpdir}/#{@prefix}", 0644))
+ assert_instance_of(GDBM, GDBM.open("#{@tmpdir}/#{@prefix}", 0644))
sleep 2
}
begin
sleep 1
assert_raise(Errno::EWOULDBLOCK) {
begin
- assert_instance_of(GDBM, gdbm2 = GDBM.open("#{@tmpdir}/#{@prefix}", 0644))
+ assert_instance_of(GDBM, GDBM.open("#{@tmpdir}/#{@prefix}", 0644))
rescue Errno::EAGAIN, Errno::EACCES
raise Errno::EWOULDBLOCK
end
@@ -187,7 +187,7 @@ if defined? GDBM
return unless have_fork? # snip this test
pid = fork() {
- assert_instance_of(GDBM, gdbm = GDBM.open("#{@tmpdir}/#{@prefix}", 0644,
+ assert_instance_of(GDBM, GDBM.open("#{@tmpdir}/#{@prefix}", 0644,
GDBM::NOLOCK))
sleep 2
}
@@ -202,10 +202,10 @@ if defined? GDBM
gdbm2.close if gdbm2
end
- p Dir.glob("#{@tmpdir}/#{@prefix}*") if $DEBUG
+ STDERR.puts Dir.glob("#{@tmpdir}/#{@prefix}*") if $DEBUG
pid = fork() {
- assert_instance_of(GDBM, gdbm = GDBM.open("#{@tmpdir}/#{@prefix}", 0644))
+ assert_instance_of(GDBM, GDBM.open("#{@tmpdir}/#{@prefix}", 0644))
sleep 2
}
begin
diff --git a/test/ruby/test_econv.rb b/test/ruby/test_econv.rb
index 2f8ec49..91c0792 100644
--- a/test/ruby/test_econv.rb
+++ b/test/ruby/test_econv.rb
@@ -44,9 +44,9 @@ class TestEncodingConverter < Test::Unit::TestCase
def test_asciicompat_encoding_iso2022jp
acenc = Encoding::Converter.asciicompat_encoding("ISO-2022-JP")
- str = "\e$B~~\(B".force_encoding("iso-2022-jp")
+ str = "\e$B~~\e(B".force_encoding("iso-2022-jp")
str2 = str.encode(acenc)
- str3 = str.encode("ISO-2022-JP")
+ str3 = str2.encode("ISO-2022-JP")
assert_equal(str, str3)
end
@@ -147,7 +147,7 @@ class TestEncodingConverter < Test::Unit::TestCase
def test_nil_source_buffer
ec = Encoding::Converter.new("UTF-8", "EUC-JP")
- ret = ec.primitive_convert(nil, dst="", nil, 10)
+ ret = ec.primitive_convert(nil, "", nil, 10)
assert_equal(:finished, ret)
end
@@ -475,44 +475,44 @@ class TestEncodingConverter < Test::Unit::TestCase
def test_errinfo_invalid_euc_jp
ec = Encoding::Converter.new("EUC-JP", "Shift_JIS")
- ec.primitive_convert(src="\xff", dst="", nil, 10)
+ ec.primitive_convert("\xff", "", nil, 10)
assert_errinfo(:invalid_byte_sequence, "EUC-JP", "Shift_JIS", "\xFF", "", ec)
end
def test_errinfo_invalid_euc_jp2
ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1")
- ec.primitive_convert(src="\xff", dst="", nil, 10)
+ ec.primitive_convert("\xff", "", nil, 10)
assert_errinfo(:invalid_byte_sequence, "EUC-JP", "UTF-8", "\xFF", "", ec)
end
def test_errinfo_undefined_hiragana
ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1")
- ec.primitive_convert(src="\xa4\xa2", dst="", nil, 10)
+ ec.primitive_convert("\xa4\xa2", "", nil, 10)
assert_errinfo(:undefined_conversion, "UTF-8", "ISO-8859-1", "\xE3\x81\x82", "", ec)
end
def test_errinfo_invalid_partial_character
ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1")
- ec.primitive_convert(src="\xa4", dst="", nil, 10)
+ ec.primitive_convert("\xa4", "", nil, 10)
assert_errinfo(:incomplete_input, "EUC-JP", "UTF-8", "\xA4", "", ec)
end
def test_errinfo_valid_partial_character
ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1")
- ec.primitive_convert(src="\xa4", dst="", nil, 10, :partial_input=>true)
+ ec.primitive_convert("\xa4", "", nil, 10, :partial_input=>true)
assert_errinfo(:source_buffer_empty, nil, nil, nil, nil, ec)
end
def test_errinfo_invalid_utf16be
ec = Encoding::Converter.new("UTF-16BE", "UTF-8")
- ec.primitive_convert(src="\xd8\x00\x00@", dst="", nil, 10)
+ ec.primitive_convert(src="\xd8\x00\x00@", "", nil, 10)
assert_errinfo(:invalid_byte_sequence, "UTF-16BE", "UTF-8", "\xD8\x00", "\x00", ec)
assert_equal("@", src)
end
def test_errinfo_invalid_utf16le
ec = Encoding::Converter.new("UTF-16LE", "UTF-8")
- ec.primitive_convert(src="\x00\xd8@\x00", dst="", nil, 10)
+ ec.primitive_convert(src="\x00\xd8@\x00", "", nil, 10)
assert_errinfo(:invalid_byte_sequence, "UTF-16LE", "UTF-8", "\x00\xD8", "@\x00", ec)
assert_equal("", src)
end
@@ -599,7 +599,7 @@ class TestEncodingConverter < Test::Unit::TestCase
def test_putback2
ec = Encoding::Converter.new("utf-16le", "euc-jp")
- ret = ec.primitive_convert(src="\x00\xd8\x21\x00", dst="", nil, nil)
+ ret = ec.primitive_convert("\x00\xd8\x21\x00", "", nil, nil)
assert_equal(:invalid_byte_sequence, ret)
assert_equal("\x00".force_encoding("utf-16le"), ec.putback(1))
assert_equal("\x21".force_encoding("utf-16le"), ec.putback(1))
@@ -705,20 +705,20 @@ class TestEncodingConverter < Test::Unit::TestCase
def test_last_error1
ec = Encoding::Converter.new("sjis", "euc-jp")
assert_equal(nil, ec.last_error)
- assert_equal(:incomplete_input, ec.primitive_convert(src="fo\x81", dst="", nil, nil))
+ assert_equal(:incomplete_input, ec.primitive_convert("fo\x81", "", nil, nil))
assert_kind_of(Encoding::InvalidByteSequenceError, ec.last_error)
end
def test_last_error2
ec = Encoding::Converter.new("sjis", "euc-jp")
- assert_equal("fo", ec.convert(src="fo\x81"))
+ assert_equal("fo", ec.convert("fo\x81"))
assert_raise(Encoding::InvalidByteSequenceError) { ec.finish }
assert_kind_of(Encoding::InvalidByteSequenceError, ec.last_error)
end
def test_us_ascii
ec = Encoding::Converter.new("UTF-8", "US-ASCII")
- ec.primitive_convert(src="\u{3042}", dst="")
+ ec.primitive_convert("\u{3042}", "")
err = ec.last_error
assert_kind_of(Encoding::UndefinedConversionError, err)
assert_equal("\u{3042}", err.error_char)
@@ -726,7 +726,7 @@ class TestEncodingConverter < Test::Unit::TestCase
def test_88591
ec = Encoding::Converter.new("UTF-8", "ISO-8859-1")
- ec.primitive_convert(src="\u{3042}", dst="")
+ ec.primitive_convert("\u{3042}", "")
err = ec.last_error
assert_kind_of(Encoding::UndefinedConversionError, err)
assert_equal("\u{3042}", err.error_char)
diff --git a/test/test_securerandom.rb b/test/test_securerandom.rb
index be951ea..f3e1bf0 100644
--- a/test/test_securerandom.rb
+++ b/test/test_securerandom.rb
@@ -87,7 +87,13 @@ end
f << 'raise LoadError'
}
$LOAD_PATH.unshift(dir)
- require 'securerandom'
+ v = $VERBOSE
+ begin
+ $VERBOSE = false
+ require 'securerandom'
+ ensure
+ $VERBOSE = v
+ end
test_s_random_bytes
end
ensure