8000 Sync options and fix inconsistent behaviour of `Zip::File#get_entry` and `Zip::File#find_entry`. by hainesr · Pull Request #423 · rubyzip/rubyzip · GitHub
[go: up one dir, main page]

Skip to content

Sync options and fix inconsistent behaviour of Zip::File#get_entry and Zip::File#find_entry. #423

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

Merged
merged 4 commits into from
Dec 15, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
A test to ensure find/get entry calls agree.
  • Loading branch information
hainesr committed Oct 31, 2019
commit cef3bc0784f9b1aaa2ca9ad437d0ec3b15cbe8a3
18 changes: 18 additions & 0 deletions test/file_options_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,24 @@ def test_restore_times_false
assert_time_equal(::Time.now, ::File.mtime(EXTPATH_2))
end

def test_get_find_consistency
testzip = ::File.expand_path(::File.join('data', 'globTest.zip'), __dir__)
file_f = ::File.expand_path('f_test.txt', Dir.tmpdir)
file_g = ::File.expand_path('g_test.txt', Dir.tmpdir)

::Zip::File.open(testzip) do |zip|
e1 = zip.find_entry('globTest/food.txt')
e1.extract(file_f)
e2 = zip.get_entry('globTest/food.txt')
e2.extract(file_g)
end

assert_time_equal(::File.mtime(file_f), ::File.mtime(file_g))
ensure
::File.unlink(file_f)
::File.unlink(file_g)
end

private

# Method to compare file times. DOS times only have 2 second accuracy.
Expand Down
0