rubyzip 1.1.6 → 1.1.7

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rubyzip might be problematic. Click here for more details.

Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +66 -13
  3. data/lib/zip.rb +5 -1
  4. data/lib/zip/central_directory.rb +1 -1
  5. data/lib/zip/crypto/encryption.rb +11 -0
  6. data/lib/zip/crypto/null_encryption.rb +45 -0
  7. data/lib/zip/crypto/traditional_encryption.rb +99 -0
  8. data/lib/zip/deflater.rb +6 -3
  9. data/lib/zip/entry.rb +11 -5
  10. data/lib/zip/entry_set.rb +5 -6
  11. data/lib/zip/extra_field.rb +1 -0
  12. data/lib/zip/extra_field/ntfs.rb +92 -0
  13. data/lib/zip/file.rb +11 -1
  14. data/lib/zip/filesystem.rb +4 -0
  15. data/lib/zip/inflater.rb +4 -3
  16. data/lib/zip/input_stream.rb +10 -4
  17. data/lib/zip/output_stream.rb +12 -7
  18. data/lib/zip/version.rb +1 -1
  19. data/test/basic_zip_file_test.rb +1 -1
  20. data/test/central_directory_entry_test.rb +1 -1
  21. data/test/central_directory_test.rb +5 -1
  22. data/test/crypto/null_encryption_test.rb +53 -0
  23. data/test/crypto/traditional_encryption_test.rb +80 -0
  24. data/test/data/WarnInvalidDate.zip +0 -0
  25. data/test/data/ntfs.zip +0 -0
  26. data/test/data/zipWithEncryption.zip +0 -0
  27. data/test/deflater_test.rb +14 -9
  28. data/test/encryption_test.rb +42 -0
  29. data/test/entry_set_test.rb +14 -1
  30. data/test/entry_test.rb +2 -2
  31. data/test/errors_test.rb +1 -1
  32. data/test/extra_field_test.rb +10 -1
  33. data/test/file_extract_directory_test.rb +3 -2
  34. data/test/file_extract_test.rb +2 -2
  35. data/test/file_split_test.rb +2 -2
  36. data/test/file_test.rb +16 -13
  37. data/test/filesystem/dir_iterator_test.rb +1 -1
  38. data/test/filesystem/directory_test.rb +1 -1
  39. data/test/filesystem/file_mutating_test.rb +1 -1
  40. data/test/filesystem/file_nonmutating_test.rb +10 -1
  41. data/test/filesystem/file_stat_test.rb +1 -1
  42. data/test/inflater_test.rb +1 -1
  43. data/test/input_stream_test.rb +1 -1
  44. data/test/ioextras/abstract_input_stream_test.rb +1 -1
  45. data/test/ioextras/abstract_output_stream_test.rb +1 -1
  46. data/test/ioextras/fake_io_test.rb +1 -1
  47. data/test/local_entry_test.rb +14 -11
  48. data/test/output_stream_test.rb +18 -3
  49. data/test/pass_thru_compressor_test.rb +2 -2
  50. data/test/pass_thru_decompressor_test.rb +1 -1
  51. data/test/settings_test.rb +23 -2
  52. data/test/test_helper.rb +1 -1
  53. data/test/unicode_file_names_and_comments_test.rb +16 -4
  54. data/test/zip64_full_test.rb +5 -1
  55. data/test/zip64_support_test.rb +1 -1
  56. metadata +104 -6
  57. data/test/dummy.txt +0 -1
Binary file
@@ -1,12 +1,17 @@
1
1
  require 'test_helper'
2
2
 
3
- class DeflaterTest < MiniTest::Unit::TestCase
3
+ class DeflaterTest < MiniTest::Test
4
4
  include CrcTest
5
5
 
6
+ DEFLATER_TEST_FILE = 'test/data/generated/deflatertest.bin'
7
+ BEST_COMP_FILE = 'test/data/generated/compressiontest_best_compression.bin'
8
+ DEFAULT_COMP_FILE = 'test/data/generated/compressiontest_default_compression.bin'
9
+ NO_COMP_FILE = 'test/data/generated/compressiontest_no_compression.bin'
10
+
6
11
  def test_outputOperator
7
12
  txt = load_file("test/data/file2.txt")
8
- deflate(txt, "deflatertest.bin")
9
- inflatedTxt = inflate("deflatertest.bin")
13
+ deflate(txt, DEFLATER_TEST_FILE)
14
+ inflatedTxt = inflate(DEFLATER_TEST_FILE)
10
15
  assert_equal(txt, inflatedTxt)
11
16
  end
12
17
 
@@ -14,15 +19,15 @@ class DeflaterTest < MiniTest::Unit::TestCase
14
19
  txt = load_file("test/data/file2.txt")
15
20
 
16
21
  Zip.default_compression = ::Zlib::BEST_COMPRESSION
17
- deflate(txt, "compressiontest_best_compression.bin")
22
+ deflate(txt, BEST_COMP_FILE)
18
23
  Zip.default_compression = ::Zlib::DEFAULT_COMPRESSION
19
- deflate(txt, "compressiontest_default_compression.bin")
24
+ deflate(txt, DEFAULT_COMP_FILE)
20
25
  Zip.default_compression = ::Zlib::NO_COMPRESSION
21
- deflate(txt, "compressiontest_no_compression.bin")
26
+ deflate(txt, NO_COMP_FILE)
22
27
 
23
- best = File.size("compressiontest_best_compression.bin")
24
- default = File.size("compressiontest_default_compression.bin")
25
- no = File.size("compressiontest_no_compression.bin")
28
+ best = File.size(BEST_COMP_FILE)
29
+ default = File.size(DEFAULT_COMP_FILE)
30
+ no = File.size(NO_COMP_FILE)
26
31
 
27
32
  assert(best < default)
28
33
  assert(best < no)
@@ -0,0 +1,42 @@
1
+ require 'test_helper'
2
+
3
+ class EncryptionTest < MiniTest::Test
4
+ ENCRYPT_ZIP_TEST_FILE = 'test/data/zipWithEncryption.zip'
5
+ INPUT_FILE1 = 'test/data/file1.txt'
6
+
7
+ def setup
8
+ @default_compression = Zip.default_compression
9
+ Zip.default_compression = ::Zlib::DEFAULT_COMPRESSION
10
+ end
11
+
12
+ def teardown
13
+ Zip.default_compression = @default_compression
14
+ end
15
+
16
+ def test_encrypt
17
+ test_file = open(ENCRYPT_ZIP_TEST_FILE, 'rb').read
18
+
19
+ @rand = [250, 143, 107, 13, 143, 22, 155, 75, 228, 150, 12]
20
+ @output = ::Zip::DOSTime.stub(:now, ::Zip::DOSTime.new(2014, 12, 17, 15, 56, 24)) do
21
+ Random.stub(:rand, lambda { |range| @rand.shift }) do
22
+ Zip::OutputStream.write_buffer(::StringIO.new(''), Zip::TraditionalEncrypter.new('password')) do |zos|
23
+ zos.put_next_entry('file1.txt')
24
+ zos.write open(INPUT_FILE1).read
25
+ end.string
26
+ end
27
+ end
28
+
29
+ @output.unpack("C*").each_with_index do |c, i|
30
+ assert_equal test_file[i].ord, c
31
+ end
32
+ end
33
+
34
+ def test_decrypt
35
+ Zip::InputStream.open(ENCRYPT_ZIP_TEST_FILE, 0, Zip::TraditionalDecrypter.new('password')) do |zis|
36
+ entry = zis.get_next_entry
37
+ assert_equal 'file1.txt', entry.name
38
+ assert_equal 1327, entry.size
39
+ assert_equal open(INPUT_FILE1, 'r').read, zis.read
40
+ end
41
+ end
42
+ end
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class ZipEntrySetTest < MiniTest::Unit::TestCase
3
+ class ZipEntrySetTest < MiniTest::Test
4
4
  ZIP_ENTRIES = [
5
5
  ::Zip::Entry.new("zipfile.zip", "name1", "comment1"),
6
6
  ::Zip::Entry.new("zipfile.zip", "name3", "comment1"),
@@ -14,6 +14,10 @@ class ZipEntrySetTest < MiniTest::Unit::TestCase
14
14
  @zipEntrySet = ::Zip::EntrySet.new(ZIP_ENTRIES)
15
15
  end
16
16
 
17
+ def teardown
18
+ ::Zip.reset!
19
+ end
20
+
17
21
  def test_include
18
22
  assert(@zipEntrySet.include?(ZIP_ENTRIES.first))
19
23
  assert(!@zipEntrySet.include?(::Zip::Entry.new("different.zip", "different", "aComment")))
@@ -68,6 +72,15 @@ class ZipEntrySetTest < MiniTest::Unit::TestCase
68
72
  assert_equal(ZIP_ENTRIES, @zipEntrySet.entries)
69
73
  end
70
74
 
75
+ def test_entries_sorted_in_each
76
+ ::Zip.sort_entries = true
77
+ arr = []
78
+ @zipEntrySet.each do |entry|
79
+ arr << entry
80
+ end
81
+ assert_equal(ZIP_ENTRIES.sort, arr)
82
+ end
83
+
71
84
  def test_compound
72
85
  newEntry = ::Zip::Entry.new("zf.zip", "new entry", "new entry's comment")
73
86
  assert_equal(ZIP_ENTRIES.size, @zipEntrySet.size)
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class ZipEntryTest < MiniTest::Unit::TestCase
3
+ class ZipEntryTest < MiniTest::Test
4
4
  TEST_ZIPFILE = "someZipFile.zip"
5
5
  TEST_COMMENT = "a comment"
6
6
  TEST_COMPRESSED_SIZE = 1234
@@ -131,7 +131,7 @@ class ZipEntryTest < MiniTest::Unit::TestCase
131
131
  end
132
132
 
133
133
  def test_store_file_without_compression
134
- File.delete('/tmp/no_compress.zip') if File.exists?('/tmp/no_compress.zip')
134
+ File.delete('/tmp/no_compress.zip') if File.exist?('/tmp/no_compress.zip')
135
135
  files = Dir[File.join('test/data/globTest', '**', '**')]
136
136
 
137
137
  Zip.setup do |z|
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
  require 'test_helper'
3
3
 
4
- class ErrorsTest < MiniTest::Unit::TestCase
4
+ class ErrorsTest < MiniTest::Test
5
5
 
6
6
  def test_rescue_legacy_zip_error
7
7
  raise ::Zip::Error
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class ZipExtraFieldTest < MiniTest::Unit::TestCase
3
+ class ZipExtraFieldTest < MiniTest::Test
4
4
  def test_new
5
5
  extra_pure = ::Zip::ExtraField.new("")
6
6
  extra_withstr = ::Zip::ExtraField.new("foo")
@@ -17,6 +17,15 @@ class ZipExtraFieldTest < MiniTest::Unit::TestCase
17
17
  assert_equal(extra.to_s, "fooabarbaz")
18
18
  end
19
19
 
20
+ def test_ntfs
21
+ str = "\x0A\x00 \x00\x00\x00\x00\x00\x01\x00\x18\x00\xC0\x81\x17\xE8B\xCE\xCF\x01\xC0\x81\x17\xE8B\xCE\xCF\x01\xC0\x81\x17\xE8B\xCE\xCF\x01"
22
+ extra = ::Zip::ExtraField.new(str)
23
+ assert(extra.member?("NTFS"))
24
+ t = ::Zip::DOSTime.at(1410496497.405178)
25
+ assert_equal(t, extra['NTFS'].mtime)
26
+ assert_equal(t, extra['NTFS'].atime)
27
+ assert_equal(t, extra['NTFS'].ctime)
28
+ end
20
29
 
21
30
  def test_merge
22
31
  str = "UT\x5\0\x3\250$\r@Ux\0\0"
@@ -1,8 +1,9 @@
1
1
  require 'test_helper'
2
2
 
3
- class ZipFileExtractDirectoryTest < MiniTest::Unit::TestCase
3
+ class ZipFileExtractDirectoryTest < MiniTest::Test
4
4
  include CommonZipFileFixture
5
- TEST_OUT_NAME = "emptyOutDir"
5
+
6
+ TEST_OUT_NAME = "test/data/generated/emptyOutDir"
6
7
 
7
8
  def open_zip(&aProc)
8
9
  assert(aProc != nil)
@@ -1,8 +1,8 @@
1
1
  require 'test_helper'
2
2
 
3
- class ZipFileExtractTest < MiniTest::Unit::TestCase
3
+ class ZipFileExtractTest < MiniTest::Test
4
4
  include CommonZipFileFixture
5
- EXTRACTED_FILENAME = "extEntry"
5
+ EXTRACTED_FILENAME = "test/data/generated/extEntry"
6
6
  ENTRY_TO_EXTRACT, *REMAINING_ENTRIES = TEST_ZIP.entry_names.reverse
7
7
 
8
8
  def setup
@@ -1,9 +1,9 @@
1
1
  require 'test_helper'
2
2
 
3
- class ZipFileSplitTest < MiniTest::Unit::TestCase
3
+ class ZipFileSplitTest < MiniTest::Test
4
4
  TEST_ZIP = TestZipFile::TEST_ZIP2.clone
5
5
  TEST_ZIP.zip_name = "large_zip_file.zip"
6
- EXTRACTED_FILENAME = "test/data/generated/extEntry"
6
+ EXTRACTED_FILENAME = "test/data/generated/extEntrySplit"
7
7
  UNSPLITTED_FILENAME = "test/data/generated/unsplitted.zip"
8
8
  ENTRY_TO_EXTRACT = TEST_ZIP.entry_names.first
9
9
 
@@ -1,9 +1,12 @@
1
1
  require 'test_helper'
2
2
 
3
3
 
4
- class ZipFileTest < MiniTest::Unit::TestCase
4
+ class ZipFileTest < MiniTest::Test
5
5
  include CommonZipFileFixture
6
6
 
7
+ OK_DELETE_FILE = 'test/data/generated/okToDelete.txt'
8
+ OK_DELETE_MOVED_FILE = 'test/data/generated/okToDeleteMoved.txt'
9
+
7
10
  def teardown
8
11
  ::Zip.write_zip64_support = false
9
12
  end
@@ -87,19 +90,17 @@ class ZipFileTest < MiniTest::Unit::TestCase
87
90
  end
88
91
 
89
92
  def test_cleans_up_tempfiles_after_close
90
- comment = "a short comment"
91
-
92
93
  zf = ::Zip::File.new(EMPTY_FILENAME, ::Zip::File::CREATE)
93
94
  zf.get_output_stream("myFile") do |os|
94
95
  @tempfile_path = os.path
95
96
  os.write "myFile contains just this"
96
97
  end
97
98
 
98
- assert_equal(true, File.exists?(@tempfile_path))
99
+ assert_equal(true, File.exist?(@tempfile_path))
99
100
 
100
101
  zf.close
101
102
 
102
- assert_equal(false, File.exists?(@tempfile_path))
103
+ assert_equal(false, File.exist?(@tempfile_path))
103
104
  end
104
105
 
105
106
  def test_add
@@ -386,13 +387,13 @@ class ZipFileTest < MiniTest::Unit::TestCase
386
387
  # can delete the file you used to add the entry to the zip file
387
388
  # with
388
389
  def test_commitUseZipEntry
389
- FileUtils.cp(TestFiles::RANDOM_ASCII_FILE1, "okToDelete.txt")
390
+ FileUtils.cp(TestFiles::RANDOM_ASCII_FILE1, OK_DELETE_FILE)
390
391
  zf = ::Zip::File.open(TEST_ZIP.zip_name)
391
- zf.add("okToDelete.txt", "okToDelete.txt")
392
+ zf.add("okToDelete.txt", OK_DELETE_FILE)
392
393
  assert_contains(zf, "okToDelete.txt")
393
394
  zf.commit
394
- File.rename("okToDelete.txt", "okToDeleteMoved.txt")
395
- assert_contains(zf, "okToDelete.txt", "okToDeleteMoved.txt")
395
+ File.rename(OK_DELETE_FILE, OK_DELETE_MOVED_FILE)
396
+ assert_contains(zf, "okToDelete.txt", OK_DELETE_MOVED_FILE)
396
397
  end
397
398
 
398
399
  # def test_close
@@ -534,10 +535,12 @@ class ZipFileTest < MiniTest::Unit::TestCase
534
535
  end
535
536
 
536
537
  data = nil
537
- Zip::File.open_buffer(File.binread(zname)) do |zipfile|
538
- zipfile.each do |entry|
539
- next unless entry.name =~ /README.md/
540
- data = zipfile.read(entry)
538
+ File.open(zname, 'rb') do |f|
539
+ Zip::File.open_buffer(f) do |zipfile|
540
+ zipfile.each do |entry|
541
+ next unless entry.name =~ /README.md/
542
+ data = zipfile.read(entry)
543
+ end
541
544
  end
542
545
  end
543
546
  assert data
@@ -1,7 +1,7 @@
1
1
  require 'test_helper'
2
2
  require 'zip/filesystem'
3
3
 
4
- class ZipFsDirIteratorTest < MiniTest::Unit::TestCase
4
+ class ZipFsDirIteratorTest < MiniTest::Test
5
5
 
6
6
  FILENAME_ARRAY = [ "f1", "f2", "f3", "f4", "f5", "f6" ]
7
7
 
@@ -1,7 +1,7 @@
1
1
  require 'test_helper'
2
2
  require 'zip/filesystem'
3
3
 
4
- class ZipFsDirectoryTest < MiniTest::Unit::TestCase
4
+ class ZipFsDirectoryTest < MiniTest::Test
5
5
  TEST_ZIP = "test/data/generated/zipWithDirs_copy.zip"
6
6
 
7
7
  def setup
@@ -1,7 +1,7 @@
1
1
  require 'test_helper'
2
2
  require 'zip/filesystem'
3
3
 
4
- class ZipFsFileMutatingTest < MiniTest::Unit::TestCase
4
+ class ZipFsFileMutatingTest < MiniTest::Test
5
5
  TEST_ZIP = "test/data/generated/zipWithDirs_copy.zip"
6
6
  def setup
7
7
  FileUtils.cp("test/data/zipWithDirs.zip", TEST_ZIP)
@@ -1,7 +1,7 @@
1
1
  require 'test_helper'
2
2
  require 'zip/filesystem'
3
3
 
4
- class ZipFsFileNonmutatingTest < MiniTest::Unit::TestCase
4
+ class ZipFsFileNonmutatingTest < MiniTest::Test
5
5
  def setup
6
6
  @zipsha = Digest::SHA1.file("test/data/zipWithDirs.zip")
7
7
  @zip_file = ::Zip::File.new("test/data/zipWithDirs.zip")
@@ -307,6 +307,15 @@ class ZipFsFileNonmutatingTest < MiniTest::Unit::TestCase
307
307
  assert_nil(@zip_file.file.stat("file1").atime)
308
308
  end
309
309
 
310
+ def test_ntfs_time
311
+ ::Zip::File.open("test/data/ntfs.zip") do |zf|
312
+ t = ::Zip::DOSTime.at(1410496497.405178)
313
+ assert_equal(zf.file.mtime("data.txt"), t)
314
+ assert_equal(zf.file.atime("data.txt"), t)
315
+ assert_equal(zf.file.ctime("data.txt"), t)
316
+ end
317
+ end
318
+
310
319
  def test_readable?
311
320
  assert(! @zip_file.file.readable?("noSuchFile"))
312
321
  assert(@zip_file.file.readable?("file1"))
@@ -1,7 +1,7 @@
1
1
  require 'test_helper'
2
2
  require 'zip/filesystem'
3
3
 
4
- class ZipFsFileStatTest < MiniTest::Unit::TestCase
4
+ class ZipFsFileStatTest < MiniTest::Test
5
5
 
6
6
  def setup
7
7
  @zip_file = ::Zip::File.new("test/data/zipWithDirs.zip")
@@ -1,5 +1,5 @@
1
1
  require 'test_helper'
2
- class InflaterTest < MiniTest::Unit::TestCase
2
+ class InflaterTest < MiniTest::Test
3
3
  include DecompressorTests
4
4
 
5
5
  def setup
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class ZipInputStreamTest < MiniTest::Unit::TestCase
3
+ class ZipInputStreamTest < MiniTest::Test
4
4
  include AssertEntry
5
5
 
6
6
  def test_new
@@ -1,7 +1,7 @@
1
1
  require 'test_helper'
2
2
  require 'zip/ioextras'
3
3
 
4
- class AbstractInputStreamTest < MiniTest::Unit::TestCase
4
+ class AbstractInputStreamTest < MiniTest::Test
5
5
  # AbstractInputStream subclass that provides a read method
6
6
 
7
7
  TEST_LINES = ["Hello world#{$/}",
@@ -1,7 +1,7 @@
1
1
  require 'test_helper'
2
2
  require 'zip/ioextras'
3
3
 
4
- class AbstractOutputStreamTest < MiniTest::Unit::TestCase
4
+ class AbstractOutputStreamTest < MiniTest::Test
5
5
  class TestOutputStream
6
6
  include ::Zip::IOExtras::AbstractOutputStream
7
7
 
@@ -1,7 +1,7 @@
1
1
  require 'test_helper'
2
2
  require 'zip/ioextras'
3
3
 
4
- class FakeIOTest < MiniTest::Unit::TestCase
4
+ class FakeIOTest < MiniTest::Test
5
5
  class FakeIOUsingClass
6
6
  include ::Zip::IOExtras::FakeIO
7
7
  end
@@ -1,6 +1,9 @@
1
1
  require 'test_helper'
2
2
 
3
- class ZipLocalEntryTest < MiniTest::Unit::TestCase
3
+ class ZipLocalEntryTest < MiniTest::Test
4
+
5
+ CEH_FILE = 'test/data/generated/centralEntryHeader.bin'
6
+ LEH_FILE = 'test/data/generated/localEntryHeader.bin'
4
7
 
5
8
  def teardown
6
9
  ::Zip.write_zip64_support = false
@@ -54,8 +57,8 @@ class ZipLocalEntryTest < MiniTest::Unit::TestCase
54
57
  entry = ::Zip::Entry.new("file.zip", "entryName", "my little comment",
55
58
  "thisIsSomeExtraInformation", 100, 987654,
56
59
  ::Zip::Entry::DEFLATED, 400)
57
- write_to_file("localEntryHeader.bin", "centralEntryHeader.bin", entry)
58
- entryReadLocal, entryReadCentral = read_from_file("localEntryHeader.bin", "centralEntryHeader.bin")
60
+ write_to_file(LEH_FILE, CEH_FILE, entry)
61
+ entryReadLocal, entryReadCentral = read_from_file(LEH_FILE, CEH_FILE)
59
62
  assert(entryReadCentral.extra['Zip64Placeholder'].nil?, 'zip64 placeholder should not be used in central directory')
60
63
  compare_local_entry_headers(entry, entryReadLocal)
61
64
  compare_c_dir_entry_headers(entry, entryReadCentral)
@@ -66,8 +69,8 @@ class ZipLocalEntryTest < MiniTest::Unit::TestCase
66
69
  entry = ::Zip::Entry.new("file.zip", "entryName", "my little comment",
67
70
  "thisIsSomeExtraInformation", 100, 987654,
68
71
  ::Zip::Entry::DEFLATED, 400)
69
- write_to_file("localEntryHeader.bin", "centralEntryHeader.bin", entry)
70
- entryReadLocal, entryReadCentral = read_from_file("localEntryHeader.bin", "centralEntryHeader.bin")
72
+ write_to_file(LEH_FILE, CEH_FILE, entry)
73
+ entryReadLocal, entryReadCentral = read_from_file(LEH_FILE, CEH_FILE)
71
74
  assert(entryReadLocal.extra['Zip64Placeholder'], 'zip64 placeholder should be used in local file header')
72
75
  entryReadLocal.extra.delete('Zip64Placeholder') # it was removed when writing the c_dir_entry, so remove from compare
73
76
  assert(entryReadCentral.extra['Zip64Placeholder'].nil?, 'zip64 placeholder should not be used in central directory')
@@ -81,8 +84,8 @@ class ZipLocalEntryTest < MiniTest::Unit::TestCase
81
84
  "malformed extra field because why not",
82
85
  0x7766554433221100, 0xDEADBEEF, ::Zip::Entry::DEFLATED,
83
86
  0x9988776655443322)
84
- write_to_file("localEntryHeader.bin", "centralEntryHeader.bin", entry)
85
- entryReadLocal, entryReadCentral = read_from_file("localEntryHeader.bin", "centralEntryHeader.bin")
87
+ write_to_file(LEH_FILE, CEH_FILE, entry)
88
+ entryReadLocal, entryReadCentral = read_from_file(LEH_FILE, CEH_FILE)
86
89
  compare_local_entry_headers(entry, entryReadLocal)
87
90
  compare_c_dir_entry_headers(entry, entryReadCentral)
88
91
  end
@@ -106,9 +109,9 @@ class ZipLocalEntryTest < MiniTest::Unit::TestCase
106
109
  def test_readLocalOffset
107
110
  entry = ::Zip::Entry.new("file.zip", "entryName")
108
111
  entry.local_header_offset = 12345
109
- ::File.open('centralEntryHeader.bin', 'wb') { |f| entry.write_c_dir_entry(f) }
112
+ ::File.open(CEH_FILE, 'wb') { |f| entry.write_c_dir_entry(f) }
110
113
  read_entry = nil
111
- ::File.open('centralEntryHeader.bin', 'rb') { |f| read_entry = ::Zip::Entry.read_c_dir_entry(f) }
114
+ ::File.open(CEH_FILE, 'rb') { |f| read_entry = ::Zip::Entry.read_c_dir_entry(f) }
112
115
  compare_c_dir_entry_headers(entry, read_entry)
113
116
  end
114
117
 
@@ -116,9 +119,9 @@ class ZipLocalEntryTest < MiniTest::Unit::TestCase
116
119
  ::Zip.write_zip64_support = true
117
120
  entry = ::Zip::Entry.new("file.zip", "entryName")
118
121
  entry.local_header_offset = 0x0123456789ABCDEF
119
- ::File.open('centralEntryHeader.bin', 'wb') { |f| entry.write_c_dir_entry(f) }
122
+ ::File.open(CEH_FILE, 'wb') { |f| entry.write_c_dir_entry(f) }
120
123
  read_entry = nil
121
- ::File.open('centralEntryHeader.bin', 'rb') { |f| read_entry = ::Zip::Entry.read_c_dir_entry(f) }
124
+ ::File.open(CEH_FILE, 'rb') { |f| read_entry = ::Zip::Entry.read_c_dir_entry(f) }
122
125
  compare_c_dir_entry_headers(entry, read_entry)
123
126
  end
124
127