Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecated warnings #313

Merged
merged 3 commits into from Feb 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .simplecov
@@ -1,9 +1,9 @@
require 'coveralls'

SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
]
])
SimpleCov.start do
add_filter '/test'
end
4 changes: 2 additions & 2 deletions lib/zip/ioextras/abstract_output_stream.rb
Expand Up @@ -20,12 +20,12 @@ def printf(a_format_string, *params)

def putc(an_object)
self << case an_object
when Fixnum
when Integer
an_object.chr
when String
an_object
else
raise TypeError, 'putc: Only Fixnum and String supported'
raise TypeError, 'putc: Only Integer and String supported'
end
an_object
end
Expand Down
2 changes: 1 addition & 1 deletion test/central_directory_entry_test.rb
Expand Up @@ -37,7 +37,7 @@ def test_read_from_stream
assert_equal('', entry.comment)

entry = ::Zip::Entry.read_c_dir_entry(file)
assert_equal(nil, entry)
assert_nil(entry)
# Fields that are not check by this test:
# version made by 2 bytes
# version needed to extract 2 bytes
Expand Down
8 changes: 6 additions & 2 deletions test/crypto/null_encryption_test.rb
Expand Up @@ -18,7 +18,9 @@ def test_header
end

def test_encrypt
[nil, '', 'a' * 10, 0xffffffff].each do |data|
assert_nil @encrypter.encrypt(nil)

['', 'a' * 10, 0xffffffff].each do |data|
assert_equal data, @encrypter.encrypt(data)
end
end
Expand All @@ -42,7 +44,9 @@ def test_gp_flags
end

def test_decrypt
[nil, '', 'a' * 10, 0xffffffff].each do |data|
assert_nil @decrypter.decrypt(nil)

['', 'a' * 10, 0xffffffff].each do |data|
assert_equal data, @decrypter.decrypt(data)
end
end
Expand Down
4 changes: 2 additions & 2 deletions test/entry_set_test.rb
Expand Up @@ -76,7 +76,7 @@ def test_find_entry
::Zip.case_insensitive_match = false
zipEntrySet = ::Zip::EntrySet.new(entries)
assert_equal(entries[0], zipEntrySet.find_entry('MiXeDcAsEnAmE'))
assert_equal(nil, zipEntrySet.find_entry('mixedcasename'))
assert_nil(zipEntrySet.find_entry('mixedcasename'))
end

def test_entries_with_sort
Expand Down Expand Up @@ -123,7 +123,7 @@ def test_parent
]
entrySet = ::Zip::EntrySet.new(entries)

assert_equal(nil, entrySet.parent(entries[0]))
assert_nil(entrySet.parent(entries[0]))
assert_equal(entries[0], entrySet.parent(entries[1]))
assert_equal(entries[1], entrySet.parent(entries[2]))
end
Expand Down
4 changes: 2 additions & 2 deletions test/entry_test.rb
Expand Up @@ -109,8 +109,8 @@ def test_parent_as_string
entry5 = ::Zip::Entry.new('zf.zip', 'aa/bb/cc')
entry6 = ::Zip::Entry.new('zf.zip', 'aa/bb/cc/')

assert_equal(nil, entry1.parent_as_string)
assert_equal(nil, entry2.parent_as_string)
assert_nil(entry1.parent_as_string)
assert_nil(entry2.parent_as_string)
assert_equal('aa/', entry3.parent_as_string)
assert_equal('aa/', entry4.parent_as_string)
assert_equal('aa/bb/', entry5.parent_as_string)
Expand Down
6 changes: 3 additions & 3 deletions test/filesystem/file_nonmutating_test.rb
Expand Up @@ -103,12 +103,12 @@ def test_size
end

def test_size?
assert_equal(nil, @zip_file.file.size?('notAFile'))
assert_nil(@zip_file.file.size?('notAFile'))
assert_equal(72, @zip_file.file.size?('file1'))
assert_equal(nil, @zip_file.file.size?('dir2/dir21'))
assert_nil(@zip_file.file.size?('dir2/dir21'))

assert_equal(72, @zip_file.file.stat('file1').size?)
assert_equal(nil, @zip_file.file.stat('dir2/dir21').size?)
assert_nil(@zip_file.file.stat('dir2/dir21').size?)
end

def test_file?
Expand Down
2 changes: 1 addition & 1 deletion test/filesystem/file_stat_test.rb
Expand Up @@ -11,7 +11,7 @@ def teardown
end

def test_blocks
assert_equal(nil, @zip_file.file.stat('file1').blocks)
assert_nil(@zip_file.file.stat('file1').blocks)
end

def test_ino
Expand Down
8 changes: 4 additions & 4 deletions test/input_stream_test.rb
Expand Up @@ -75,12 +75,12 @@ def test_incomplete_reads
entry = zis.get_next_entry # empty.txt
assert_equal(TestZipFile::TEST_ZIP2.entry_names[1], entry.name)
assert_equal(0, entry.size)
assert_equal(nil, zis.gets)
assert_nil(zis.gets)
assert_equal(true, zis.eof?)
entry = zis.get_next_entry # empty_chmod640.txt
assert_equal(TestZipFile::TEST_ZIP2.entry_names[2], entry.name)
assert_equal(0, entry.size)
assert_equal(nil, zis.gets)
assert_nil(zis.gets)
assert_equal(true, zis.eof?)
entry = zis.get_next_entry # short.txt
assert_equal(TestZipFile::TEST_ZIP2.entry_names[3], entry.name)
Expand All @@ -102,12 +102,12 @@ def test_incomplete_reads_from_string_io
entry = zis.get_next_entry # empty.txt
assert_equal(TestZipFile::TEST_ZIP2.entry_names[1], entry.name)
assert_equal(0, entry.size)
assert_equal(nil, zis.gets)
assert_nil(zis.gets)
assert_equal(true, zis.eof?)
entry = zis.get_next_entry # empty_chmod640.txt
assert_equal(TestZipFile::TEST_ZIP2.entry_names[2], entry.name)
assert_equal(0, entry.size)
assert_equal(nil, zis.gets)
assert_nil(zis.gets)
assert_equal(true, zis.eof?)
entry = zis.get_next_entry # short.txt
assert_equal(TestZipFile::TEST_ZIP2.entry_names[3], entry.name)
Expand Down
2 changes: 1 addition & 1 deletion test/ioextras/abstract_input_stream_test.rb
Expand Up @@ -44,7 +44,7 @@ def test_gets
assert_equal(2, @io.lineno)
assert_equal(TEST_LINES[2], @io.gets)
assert_equal(3, @io.lineno)
assert_equal(nil, @io.gets)
assert_nil(@io.gets)
assert_equal(4, @io.lineno)
end

Expand Down
2 changes: 1 addition & 1 deletion test/ioextras/fake_io_test.rb
Expand Up @@ -12,7 +12,7 @@ def test_kind_of?
assert(obj.kind_of?(Object))
assert(obj.kind_of?(FakeIOUsingClass))
assert(obj.kind_of?(IO))
assert(!obj.kind_of?(Fixnum))
assert(!obj.kind_of?(Integer))
assert(!obj.kind_of?(String))
end
end
2 changes: 1 addition & 1 deletion test/local_entry_test.rb
Expand Up @@ -36,7 +36,7 @@ def test_read_date_time

def test_read_local_entry_from_non_zip_file
::File.open('test/data/file2.txt') do |file|
assert_equal(nil, ::Zip::Entry.read_local_entry(file))
assert_nil(::Zip::Entry.read_local_entry(file))
end
end

Expand Down
2 changes: 1 addition & 1 deletion test/test_helper.rb
Expand Up @@ -134,7 +134,7 @@ def assert_stream_contents(zis, testZipFile)
testZipFile.entry_names.each do |entryName|
assert_next_entry(entryName, zis)
end
assert_equal(nil, zis.get_next_entry)
assert_nil(zis.get_next_entry)
end

def assert_test_zip_contents(testZipFile)
Expand Down