hotplate 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +4 -0
- data/Rakefile +1 -0
- data/bin/toast +2 -0
- data/hotplate.gemspec +30 -0
- data/lib/hotplate/cli/build.rb +51 -0
- data/lib/hotplate/cli/init.rb +64 -0
- data/lib/hotplate/cli/main.rb +39 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/README.md +271 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/Rakefile +19 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/TODO +15 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/central_directory.rb +208 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/compressor.rb +10 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/constants.rb +63 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/crypto/encryption.rb +11 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/crypto/null_encryption.rb +45 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/crypto/traditional_encryption.rb +99 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/decompressor.rb +13 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/deflater.rb +32 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/dos_time.rb +49 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/entry.rb +696 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/entry_set.rb +86 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/errors.rb +16 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/extra_field/generic.rb +43 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/extra_field/ntfs.rb +92 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/extra_field/old_unix.rb +45 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/extra_field/universal_time.rb +47 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/extra_field/unix.rb +38 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/extra_field/zip64.rb +67 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/extra_field/zip64_placeholder.rb +16 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/extra_field.rb +101 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/file.rb +436 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/filesystem.rb +626 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/inflater.rb +66 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/input_stream.rb +164 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/ioextras/abstract_input_stream.rb +115 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/ioextras/abstract_output_stream.rb +45 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/ioextras.rb +38 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/null_compressor.rb +15 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/null_decompressor.rb +27 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/null_input_stream.rb +10 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/output_stream.rb +190 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/pass_thru_compressor.rb +23 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/pass_thru_decompressor.rb +41 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/streamable_directory.rb +15 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/streamable_stream.rb +56 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/version.rb +3 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip.rb +63 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/samples/example.rb +91 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/samples/example_filesystem.rb +33 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/samples/example_recursive.rb +48 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/samples/gtkRubyzip.rb +86 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/samples/qtzip.rb +101 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/samples/write_simple.rb +13 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/samples/zipfind.rb +74 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/basic_zip_file_test.rb +64 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/central_directory_entry_test.rb +73 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/central_directory_test.rb +104 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/crypto/null_encryption_test.rb +53 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/crypto/traditional_encryption_test.rb +80 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/data/WarnInvalidDate.zip +0 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/data/file1.txt +46 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/data/file1.txt.deflatedData +0 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/data/file2.txt +1504 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/data/globTest/foo/bar/baz/foo.txt +0 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/data/globTest/foo.txt +0 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/data/globTest/food.txt +0 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/data/globTest.zip +0 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/data/mimetype +1 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/data/notzippedruby.rb +7 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/data/ntfs.zip +0 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/data/rubycode.zip +0 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/data/rubycode2.zip +0 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/data/testDirectory.bin +0 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/data/zip64-sample.zip +0 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/data/zipWithDirs.zip +0 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/data/zipWithEncryption.zip +0 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/deflater_test.rb +67 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/encryption_test.rb +42 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/entry_set_test.rb +138 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/entry_test.rb +165 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/errors_test.rb +36 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/extra_field_test.rb +78 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/file_extract_directory_test.rb +56 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/file_extract_test.rb +90 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/file_split_test.rb +60 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/file_test.rb +559 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/filesystem/dir_iterator_test.rb +62 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/filesystem/directory_test.rb +131 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/filesystem/file_mutating_test.rb +100 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/filesystem/file_nonmutating_test.rb +514 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/filesystem/file_stat_test.rb +66 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/gentestfiles.rb +134 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/inflater_test.rb +14 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/input_stream_test.rb +170 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/ioextras/abstract_input_stream_test.rb +103 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/ioextras/abstract_output_stream_test.rb +106 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/ioextras/fake_io_test.rb +18 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/local_entry_test.rb +156 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/output_stream_test.rb +129 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/pass_thru_compressor_test.rb +31 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/pass_thru_decompressor_test.rb +15 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/settings_test.rb +92 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/test_helper.rb +228 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/unicode_file_names_and_comments_test.rb +52 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/zip64_full_test.rb +53 -0
- data/lib/hotplate/gems/rubyzip-1.1.7/test/zip64_support_test.rb +15 -0
- data/lib/hotplate/java/build.gradle +38 -0
- data/lib/hotplate/java/gradle/wrapper/gradle-wrapper.jar +0 -0
- data/lib/hotplate/java/gradle/wrapper/gradle-wrapper.properties +6 -0
- data/lib/hotplate/java/gradlew +164 -0
- data/lib/hotplate/java/gradlew.bat +90 -0
- data/lib/hotplate/java/template.java +25 -0
- data/lib/hotplate/version.rb +3 -0
- data/lib/hotplate.rb +2 -0
- metadata +186 -0
@@ -0,0 +1,90 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class ZipFileExtractTest < MiniTest::Test
|
4
|
+
include CommonZipFileFixture
|
5
|
+
EXTRACTED_FILENAME = "test/data/generated/extEntry"
|
6
|
+
ENTRY_TO_EXTRACT, *REMAINING_ENTRIES = TEST_ZIP.entry_names.reverse
|
7
|
+
|
8
|
+
def setup
|
9
|
+
super
|
10
|
+
::File.delete(EXTRACTED_FILENAME) if ::File.exist?(EXTRACTED_FILENAME)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_extract
|
14
|
+
::Zip::File.open(TEST_ZIP.zip_name) {
|
15
|
+
|zf|
|
16
|
+
zf.extract(ENTRY_TO_EXTRACT, EXTRACTED_FILENAME)
|
17
|
+
|
18
|
+
assert(File.exist?(EXTRACTED_FILENAME))
|
19
|
+
AssertEntry::assert_contents(EXTRACTED_FILENAME,
|
20
|
+
zf.get_input_stream(ENTRY_TO_EXTRACT) { |is| is.read })
|
21
|
+
|
22
|
+
|
23
|
+
::File.unlink(EXTRACTED_FILENAME)
|
24
|
+
|
25
|
+
entry = zf.get_entry(ENTRY_TO_EXTRACT)
|
26
|
+
entry.extract(EXTRACTED_FILENAME)
|
27
|
+
|
28
|
+
assert(File.exist?(EXTRACTED_FILENAME))
|
29
|
+
AssertEntry::assert_contents(EXTRACTED_FILENAME,
|
30
|
+
entry.get_input_stream() { |is| is.read })
|
31
|
+
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_extractExists
|
36
|
+
writtenText = "written text"
|
37
|
+
::File.open(EXTRACTED_FILENAME, "w") { |f| f.write(writtenText) }
|
38
|
+
|
39
|
+
assert_raises(::Zip::DestinationFileExistsError) {
|
40
|
+
::Zip::File.open(TEST_ZIP.zip_name) { |zf|
|
41
|
+
zf.extract(zf.entries.first, EXTRACTED_FILENAME)
|
42
|
+
}
|
43
|
+
}
|
44
|
+
File.open(EXTRACTED_FILENAME, "r") { |f|
|
45
|
+
assert_equal(writtenText, f.read)
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_extractExistsOverwrite
|
50
|
+
writtenText = "written text"
|
51
|
+
::File.open(EXTRACTED_FILENAME, "w") { |f| f.write(writtenText) }
|
52
|
+
|
53
|
+
gotCalledCorrectly = false
|
54
|
+
::Zip::File.open(TEST_ZIP.zip_name) {
|
55
|
+
|zf|
|
56
|
+
zf.extract(zf.entries.first, EXTRACTED_FILENAME) {
|
57
|
+
|entry, extractLoc|
|
58
|
+
gotCalledCorrectly = zf.entries.first == entry &&
|
59
|
+
extractLoc == EXTRACTED_FILENAME
|
60
|
+
true
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
assert(gotCalledCorrectly)
|
65
|
+
::File.open(EXTRACTED_FILENAME, "r") {
|
66
|
+
|f|
|
67
|
+
assert(writtenText != f.read)
|
68
|
+
}
|
69
|
+
end
|
70
|
+
|
71
|
+
def test_extractNonEntry
|
72
|
+
zf = ::Zip::File.new(TEST_ZIP.zip_name)
|
73
|
+
assert_raises(Errno::ENOENT) { zf.extract("nonExistingEntry", "nonExistingEntry") }
|
74
|
+
ensure
|
75
|
+
zf.close if zf
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_extractNonEntry2
|
79
|
+
outFile = "outfile"
|
80
|
+
assert_raises(Errno::ENOENT) {
|
81
|
+
zf = ::Zip::File.new(TEST_ZIP.zip_name)
|
82
|
+
nonEntry = "hotdog-diddelidoo"
|
83
|
+
assert(!zf.entries.include?(nonEntry))
|
84
|
+
zf.extract(nonEntry, outFile)
|
85
|
+
zf.close
|
86
|
+
}
|
87
|
+
assert(!File.exist?(outFile))
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class ZipFileSplitTest < MiniTest::Test
|
4
|
+
TEST_ZIP = TestZipFile::TEST_ZIP2.clone
|
5
|
+
TEST_ZIP.zip_name = "large_zip_file.zip"
|
6
|
+
EXTRACTED_FILENAME = "test/data/generated/extEntrySplit"
|
7
|
+
UNSPLITTED_FILENAME = "test/data/generated/unsplitted.zip"
|
8
|
+
ENTRY_TO_EXTRACT = TEST_ZIP.entry_names.first
|
9
|
+
|
10
|
+
def setup
|
11
|
+
FileUtils.cp(TestZipFile::TEST_ZIP2.zip_name, TEST_ZIP.zip_name)
|
12
|
+
end
|
13
|
+
|
14
|
+
def teardown
|
15
|
+
File.delete(TEST_ZIP.zip_name)
|
16
|
+
File.delete(UNSPLITTED_FILENAME) if File.exist?(UNSPLITTED_FILENAME)
|
17
|
+
|
18
|
+
Dir["#{TEST_ZIP.zip_name}.*"].each do |zip_file_name|
|
19
|
+
File.delete(zip_file_name) if File.exist?(zip_file_name)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_split_method_respond
|
24
|
+
assert_respond_to ::Zip::File, :split, "Does not have split class method"
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_split
|
28
|
+
result = ::Zip::File.split(TEST_ZIP.zip_name, 65536, false)
|
29
|
+
|
30
|
+
unless result.nil?
|
31
|
+
Dir["#{TEST_ZIP.zip_name}.*"].sort.each_with_index do |zip_file_name, index|
|
32
|
+
File.open(zip_file_name, 'rb') do |zip_file|
|
33
|
+
zip_file.read([::Zip::File::SPLIT_SIGNATURE].pack('V').size) if index == 0
|
34
|
+
File.open(UNSPLITTED_FILENAME, 'ab') do |file|
|
35
|
+
file << zip_file.read
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
::Zip::File.open(UNSPLITTED_FILENAME) do |zf|
|
41
|
+
zf.extract(ENTRY_TO_EXTRACT, EXTRACTED_FILENAME)
|
42
|
+
|
43
|
+
assert(File.exist?(EXTRACTED_FILENAME))
|
44
|
+
AssertEntry::assert_contents(EXTRACTED_FILENAME,
|
45
|
+
zf.get_input_stream(ENTRY_TO_EXTRACT) { |is| is.read })
|
46
|
+
|
47
|
+
|
48
|
+
File.unlink(EXTRACTED_FILENAME)
|
49
|
+
|
50
|
+
entry = zf.get_entry(ENTRY_TO_EXTRACT)
|
51
|
+
entry.extract(EXTRACTED_FILENAME)
|
52
|
+
|
53
|
+
assert(File.exist?(EXTRACTED_FILENAME))
|
54
|
+
AssertEntry::assert_contents(EXTRACTED_FILENAME,
|
55
|
+
entry.get_input_stream() { |is| is.read })
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,559 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
|
4
|
+
class ZipFileTest < MiniTest::Test
|
5
|
+
include CommonZipFileFixture
|
6
|
+
|
7
|
+
OK_DELETE_FILE = 'test/data/generated/okToDelete.txt'
|
8
|
+
OK_DELETE_MOVED_FILE = 'test/data/generated/okToDeleteMoved.txt'
|
9
|
+
|
10
|
+
def teardown
|
11
|
+
::Zip.write_zip64_support = false
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_createFromScratchToBuffer
|
15
|
+
comment = "a short comment"
|
16
|
+
|
17
|
+
buffer = ::Zip::File.add_buffer do |zf|
|
18
|
+
zf.get_output_stream("myFile") { |os| os.write "myFile contains just this" }
|
19
|
+
zf.mkdir("dir1")
|
20
|
+
zf.comment = comment
|
21
|
+
end
|
22
|
+
|
23
|
+
::File.open(EMPTY_FILENAME, 'wb') { |file| file.write buffer.string }
|
24
|
+
|
25
|
+
zfRead = ::Zip::File.new(EMPTY_FILENAME)
|
26
|
+
assert_equal(comment, zfRead.comment)
|
27
|
+
assert_equal(2, zfRead.entries.length)
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_createFromScratch
|
31
|
+
comment = "a short comment"
|
32
|
+
|
33
|
+
zf = ::Zip::File.new(EMPTY_FILENAME, ::Zip::File::CREATE)
|
34
|
+
zf.get_output_stream("myFile") { |os| os.write "myFile contains just this" }
|
35
|
+
zf.mkdir("dir1")
|
36
|
+
zf.comment = comment
|
37
|
+
zf.close
|
38
|
+
|
39
|
+
zfRead = ::Zip::File.new(EMPTY_FILENAME)
|
40
|
+
assert_equal(comment, zfRead.comment)
|
41
|
+
assert_equal(2, zfRead.entries.length)
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_get_output_stream
|
45
|
+
entryCount = nil
|
46
|
+
::Zip::File.open(TEST_ZIP.zip_name) {
|
47
|
+
|zf|
|
48
|
+
entryCount = zf.size
|
49
|
+
zf.get_output_stream('newEntry.txt') {
|
50
|
+
|os|
|
51
|
+
os.write "Putting stuff in newEntry.txt"
|
52
|
+
}
|
53
|
+
assert_equal(entryCount+1, zf.size)
|
54
|
+
assert_equal("Putting stuff in newEntry.txt", zf.read("newEntry.txt"))
|
55
|
+
|
56
|
+
zf.get_output_stream(zf.get_entry('test/data/generated/empty.txt')) {
|
57
|
+
|os|
|
58
|
+
os.write "Putting stuff in data/generated/empty.txt"
|
59
|
+
}
|
60
|
+
assert_equal(entryCount+1, zf.size)
|
61
|
+
assert_equal("Putting stuff in data/generated/empty.txt", zf.read("test/data/generated/empty.txt"))
|
62
|
+
|
63
|
+
custom_entry_args = [ZipEntryTest::TEST_COMMENT, ZipEntryTest::TEST_EXTRA, ZipEntryTest::TEST_COMPRESSED_SIZE, ZipEntryTest::TEST_CRC, ::Zip::Entry::STORED, ZipEntryTest::TEST_SIZE, ZipEntryTest::TEST_TIME]
|
64
|
+
zf.get_output_stream('entry_with_custom_args.txt', nil, *custom_entry_args) {
|
65
|
+
|os|
|
66
|
+
os.write "Some data"
|
67
|
+
}
|
68
|
+
assert_equal(entryCount+2, zf.size)
|
69
|
+
entry = zf.get_entry('entry_with_custom_args.txt')
|
70
|
+
assert_equal(custom_entry_args[0], entry.comment)
|
71
|
+
assert_equal(custom_entry_args[2], entry.compressed_size)
|
72
|
+
assert_equal(custom_entry_args[3], entry.crc)
|
73
|
+
assert_equal(custom_entry_args[4], entry.compression_method)
|
74
|
+
assert_equal(custom_entry_args[5], entry.size)
|
75
|
+
assert_equal(custom_entry_args[6], entry.time)
|
76
|
+
|
77
|
+
zf.get_output_stream('entry.bin') {
|
78
|
+
|os|
|
79
|
+
os.write(::File.open('test/data/generated/5entry.zip', 'rb').read)
|
80
|
+
}
|
81
|
+
}
|
82
|
+
|
83
|
+
::Zip::File.open(TEST_ZIP.zip_name) {
|
84
|
+
|zf|
|
85
|
+
assert_equal(entryCount+3, zf.size)
|
86
|
+
assert_equal("Putting stuff in newEntry.txt", zf.read("newEntry.txt"))
|
87
|
+
assert_equal("Putting stuff in data/generated/empty.txt", zf.read("test/data/generated/empty.txt"))
|
88
|
+
assert_equal(File.open('test/data/generated/5entry.zip', 'rb').read, zf.read("entry.bin"))
|
89
|
+
}
|
90
|
+
end
|
91
|
+
|
92
|
+
def test_cleans_up_tempfiles_after_close
|
93
|
+
zf = ::Zip::File.new(EMPTY_FILENAME, ::Zip::File::CREATE)
|
94
|
+
zf.get_output_stream("myFile") do |os|
|
95
|
+
@tempfile_path = os.path
|
96
|
+
os.write "myFile contains just this"
|
97
|
+
end
|
98
|
+
|
99
|
+
assert_equal(true, File.exist?(@tempfile_path))
|
100
|
+
|
101
|
+
zf.close
|
102
|
+
|
103
|
+
assert_equal(false, File.exist?(@tempfile_path))
|
104
|
+
end
|
105
|
+
|
106
|
+
def test_add
|
107
|
+
srcFile = "test/data/file2.txt"
|
108
|
+
entryName = "newEntryName.rb"
|
109
|
+
assert(::File.exist?(srcFile))
|
110
|
+
zf = ::Zip::File.new(EMPTY_FILENAME, ::Zip::File::CREATE)
|
111
|
+
zf.add(entryName, srcFile)
|
112
|
+
zf.close
|
113
|
+
|
114
|
+
zfRead = ::Zip::File.new(EMPTY_FILENAME)
|
115
|
+
assert_equal("", zfRead.comment)
|
116
|
+
assert_equal(1, zfRead.entries.length)
|
117
|
+
assert_equal(entryName, zfRead.entries.first.name)
|
118
|
+
AssertEntry.assert_contents(srcFile,
|
119
|
+
zfRead.get_input_stream(entryName) { |zis| zis.read })
|
120
|
+
end
|
121
|
+
|
122
|
+
def test_recover_permissions_after_add_files_to_archive
|
123
|
+
srcZip = TEST_ZIP.zip_name
|
124
|
+
::File.chmod(0664, srcZip)
|
125
|
+
srcFile = "test/data/file2.txt"
|
126
|
+
entryName = "newEntryName.rb"
|
127
|
+
assert_equal(::File.stat(srcZip).mode, 0100664)
|
128
|
+
assert(::File.exist?(srcZip))
|
129
|
+
zf = ::Zip::File.new(srcZip, ::Zip::File::CREATE)
|
130
|
+
zf.add(entryName, srcFile)
|
131
|
+
zf.close
|
132
|
+
assert_equal(::File.stat(srcZip).mode, 0100664)
|
133
|
+
end
|
134
|
+
|
135
|
+
def test_addExistingEntryName
|
136
|
+
assert_raises(::Zip::EntryExistsError) {
|
137
|
+
::Zip::File.open(TEST_ZIP.zip_name) {
|
138
|
+
|zf|
|
139
|
+
zf.add(zf.entries.first.name, "test/data/file2.txt")
|
140
|
+
}
|
141
|
+
}
|
142
|
+
end
|
143
|
+
|
144
|
+
def test_addExistingEntryNameReplace
|
145
|
+
gotCalled = false
|
146
|
+
replacedEntry = nil
|
147
|
+
::Zip::File.open(TEST_ZIP.zip_name) {
|
148
|
+
|zf|
|
149
|
+
replacedEntry = zf.entries.first.name
|
150
|
+
zf.add(replacedEntry, "test/data/file2.txt") { gotCalled = true; true }
|
151
|
+
}
|
152
|
+
assert(gotCalled)
|
153
|
+
::Zip::File.open(TEST_ZIP.zip_name) {
|
154
|
+
|zf|
|
155
|
+
assert_contains(zf, replacedEntry, "test/data/file2.txt")
|
156
|
+
}
|
157
|
+
end
|
158
|
+
|
159
|
+
def test_addDirectory
|
160
|
+
::Zip::File.open(TEST_ZIP.zip_name) {
|
161
|
+
|zf|
|
162
|
+
zf.add(TestFiles::EMPTY_TEST_DIR, TestFiles::EMPTY_TEST_DIR)
|
163
|
+
}
|
164
|
+
::Zip::File.open(TEST_ZIP.zip_name) {
|
165
|
+
|zf|
|
166
|
+
dirEntry = zf.entries.detect { |e| e.name == TestFiles::EMPTY_TEST_DIR+"/" }
|
167
|
+
assert(dirEntry.directory?)
|
168
|
+
}
|
169
|
+
end
|
170
|
+
|
171
|
+
def test_remove
|
172
|
+
entryToRemove, *remainingEntries = TEST_ZIP.entry_names
|
173
|
+
|
174
|
+
FileUtils.cp(TestZipFile::TEST_ZIP2.zip_name, TEST_ZIP.zip_name)
|
175
|
+
|
176
|
+
zf = ::Zip::File.new(TEST_ZIP.zip_name)
|
177
|
+
assert(zf.entries.map { |e| e.name }.include?(entryToRemove))
|
178
|
+
zf.remove(entryToRemove)
|
179
|
+
assert(!zf.entries.map { |e| e.name }.include?(entryToRemove))
|
180
|
+
assert_equal(zf.entries.map { |x| x.name }.sort, remainingEntries.sort)
|
181
|
+
zf.close
|
182
|
+
|
183
|
+
zfRead = ::Zip::File.new(TEST_ZIP.zip_name)
|
184
|
+
assert(!zfRead.entries.map { |e| e.name }.include?(entryToRemove))
|
185
|
+
assert_equal(zfRead.entries.map { |x| x.name }.sort, remainingEntries.sort)
|
186
|
+
zfRead.close
|
187
|
+
end
|
188
|
+
|
189
|
+
def test_rename
|
190
|
+
entryToRename, * = TEST_ZIP.entry_names
|
191
|
+
|
192
|
+
zf = ::Zip::File.new(TEST_ZIP.zip_name)
|
193
|
+
assert(zf.entries.map { |e| e.name }.include?(entryToRename))
|
194
|
+
|
195
|
+
contents = zf.read(entryToRename)
|
196
|
+
newName = "changed entry name"
|
197
|
+
assert(!zf.entries.map { |e| e.name }.include?(newName))
|
198
|
+
|
199
|
+
zf.rename(entryToRename, newName)
|
200
|
+
assert(zf.entries.map { |e| e.name }.include?(newName))
|
201
|
+
|
202
|
+
assert_equal(contents, zf.read(newName))
|
203
|
+
|
204
|
+
zf.close
|
205
|
+
|
206
|
+
zfRead = ::Zip::File.new(TEST_ZIP.zip_name)
|
207
|
+
assert(zfRead.entries.map { |e| e.name }.include?(newName))
|
208
|
+
assert_equal(contents, zfRead.read(newName))
|
209
|
+
zfRead.close
|
210
|
+
end
|
211
|
+
|
212
|
+
def test_rename_with_each
|
213
|
+
zf_name = 'test_rename_zip.zip'
|
214
|
+
if ::File.exist?(zf_name)
|
215
|
+
::File.unlink(zf_name)
|
216
|
+
end
|
217
|
+
arr = []
|
218
|
+
arr_renamed = []
|
219
|
+
::Zip::File.open(zf_name, ::Zip::File::CREATE) do |zf|
|
220
|
+
zf.mkdir('test')
|
221
|
+
arr << 'test/'
|
222
|
+
arr_renamed << 'Ztest/'
|
223
|
+
%w(a b c d).each do |f|
|
224
|
+
zf.get_output_stream("test/#{f}") { |file| file.puts 'aaaa' }
|
225
|
+
arr << "test/#{f}"
|
226
|
+
arr_renamed << "Ztest/#{f}"
|
227
|
+
end
|
228
|
+
end
|
229
|
+
zf = ::Zip::File.open(zf_name)
|
230
|
+
assert_equal(zf.entries.map(&:name), arr)
|
231
|
+
zf.close
|
232
|
+
Zip::File.open(zf_name, "wb") do |z|
|
233
|
+
z.each do |f|
|
234
|
+
z.rename(f, "Z#{f.name}")
|
235
|
+
end
|
236
|
+
end
|
237
|
+
zf = ::Zip::File.open(zf_name)
|
238
|
+
assert_equal(zf.entries.map(&:name), arr_renamed)
|
239
|
+
zf.close
|
240
|
+
if ::File.exist?(zf_name)
|
241
|
+
::File.unlink(zf_name)
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
def test_renameToExistingEntry
|
246
|
+
oldEntries = nil
|
247
|
+
::Zip::File.open(TEST_ZIP.zip_name) { |zf| oldEntries = zf.entries }
|
248
|
+
|
249
|
+
assert_raises(::Zip::EntryExistsError) do
|
250
|
+
::Zip::File.open(TEST_ZIP.zip_name) do |zf|
|
251
|
+
zf.rename(zf.entries[0], zf.entries[1].name)
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
::Zip::File.open(TEST_ZIP.zip_name) do |zf|
|
256
|
+
assert_equal(oldEntries.sort.map { |e| e.name }, zf.entries.sort.map { |e| e.name })
|
257
|
+
end
|
258
|
+
end
|
259
|
+
|
260
|
+
def test_renameToExistingEntryOverwrite
|
261
|
+
oldEntries = nil
|
262
|
+
::Zip::File.open(TEST_ZIP.zip_name) { |zf| oldEntries = zf.entries }
|
263
|
+
|
264
|
+
gotCalled = false
|
265
|
+
renamedEntryName = nil
|
266
|
+
::Zip::File.open(TEST_ZIP.zip_name) do |zf|
|
267
|
+
renamedEntryName = zf.entries[0].name
|
268
|
+
zf.rename(zf.entries[0], zf.entries[1].name) { gotCalled = true; true }
|
269
|
+
end
|
270
|
+
|
271
|
+
assert(gotCalled)
|
272
|
+
oldEntries.delete_if { |e| e.name == renamedEntryName }
|
273
|
+
::Zip::File.open(TEST_ZIP.zip_name) do |zf|
|
274
|
+
assert_equal(oldEntries.sort.map { |e| e.name },
|
275
|
+
zf.entries.sort.map { |e| e.name })
|
276
|
+
end
|
277
|
+
end
|
278
|
+
|
279
|
+
def test_renameNonEntry
|
280
|
+
nonEntry = "bogusEntry"
|
281
|
+
target_entry = "target_entryName"
|
282
|
+
zf = ::Zip::File.new(TEST_ZIP.zip_name)
|
283
|
+
assert(!zf.entries.include?(nonEntry))
|
284
|
+
assert_raises(Errno::ENOENT) {
|
285
|
+
zf.rename(nonEntry, target_entry)
|
286
|
+
}
|
287
|
+
zf.commit
|
288
|
+
assert(!zf.entries.include?(target_entry))
|
289
|
+
ensure
|
290
|
+
zf.close
|
291
|
+
end
|
292
|
+
|
293
|
+
def test_renameEntryToExistingEntry
|
294
|
+
entry1, entry2, * = TEST_ZIP.entry_names
|
295
|
+
zf = ::Zip::File.new(TEST_ZIP.zip_name)
|
296
|
+
assert_raises(::Zip::EntryExistsError) {
|
297
|
+
zf.rename(entry1, entry2)
|
298
|
+
}
|
299
|
+
ensure
|
300
|
+
zf.close
|
301
|
+
end
|
302
|
+
|
303
|
+
def test_replace
|
304
|
+
entryToReplace = TEST_ZIP.entry_names[2]
|
305
|
+
newEntrySrcFilename = "test/data/file2.txt"
|
306
|
+
zf = ::Zip::File.new(TEST_ZIP.zip_name)
|
307
|
+
zf.replace(entryToReplace, newEntrySrcFilename)
|
308
|
+
|
309
|
+
zf.close
|
310
|
+
zfRead = ::Zip::File.new(TEST_ZIP.zip_name)
|
311
|
+
AssertEntry::assert_contents(newEntrySrcFilename,
|
312
|
+
zfRead.get_input_stream(entryToReplace) { |is| is.read })
|
313
|
+
AssertEntry::assert_contents(TEST_ZIP.entry_names[0],
|
314
|
+
zfRead.get_input_stream(TEST_ZIP.entry_names[0]) { |is| is.read })
|
315
|
+
AssertEntry::assert_contents(TEST_ZIP.entry_names[1],
|
316
|
+
zfRead.get_input_stream(TEST_ZIP.entry_names[1]) { |is| is.read })
|
317
|
+
AssertEntry::assert_contents(TEST_ZIP.entry_names[3],
|
318
|
+
zfRead.get_input_stream(TEST_ZIP.entry_names[3]) { |is| is.read })
|
319
|
+
zfRead.close
|
320
|
+
end
|
321
|
+
|
322
|
+
def test_replaceNonEntry
|
323
|
+
entryToReplace = "nonExistingEntryname"
|
324
|
+
::Zip::File.open(TEST_ZIP.zip_name) {
|
325
|
+
|zf|
|
326
|
+
assert_raises(Errno::ENOENT) {
|
327
|
+
zf.replace(entryToReplace, "test/data/file2.txt")
|
328
|
+
}
|
329
|
+
}
|
330
|
+
end
|
331
|
+
|
332
|
+
def test_commit
|
333
|
+
newName = "renamedFirst"
|
334
|
+
zf = ::Zip::File.new(TEST_ZIP.zip_name)
|
335
|
+
oldName = zf.entries.first
|
336
|
+
zf.rename(oldName, newName)
|
337
|
+
zf.commit
|
338
|
+
|
339
|
+
zfRead = ::Zip::File.new(TEST_ZIP.zip_name)
|
340
|
+
assert(zfRead.entries.detect { |e| e.name == newName } != nil)
|
341
|
+
assert(zfRead.entries.detect { |e| e.name == oldName } == nil)
|
342
|
+
zfRead.close
|
343
|
+
|
344
|
+
zf.close
|
345
|
+
res = system("unzip -t #{TEST_ZIP.zip_name}")
|
346
|
+
assert_equal(res, true)
|
347
|
+
end
|
348
|
+
|
349
|
+
def test_double_commit(filename = 'test/data/generated/double_commit_test.zip')
|
350
|
+
::FileUtils.touch('test/data/generated/test_double_commit1.txt')
|
351
|
+
::FileUtils.touch('test/data/generated/test_double_commit2.txt')
|
352
|
+
zf = ::Zip::File.open(filename, ::Zip::File::CREATE)
|
353
|
+
zf.add('test1.txt', 'test/data/generated/test_double_commit1.txt')
|
354
|
+
zf.commit
|
355
|
+
zf.add('test2.txt', 'test/data/generated/test_double_commit2.txt')
|
356
|
+
zf.commit
|
357
|
+
zf.close
|
358
|
+
zf2 = ::Zip::File.open(filename)
|
359
|
+
assert(zf2.entries.detect {|e| e.name == 'test1.txt'} != nil )
|
360
|
+
assert(zf2.entries.detect {|e| e.name == 'test2.txt'} != nil )
|
361
|
+
res = system("unzip -t #{filename}")
|
362
|
+
assert_equal(res, true)
|
363
|
+
end
|
364
|
+
|
365
|
+
def test_double_commit_zip64
|
366
|
+
::Zip.write_zip64_support = true
|
367
|
+
test_double_commit('test/data/generated/double_commit_test64.zip')
|
368
|
+
end
|
369
|
+
|
370
|
+
def test_write_buffer
|
371
|
+
newName = "renamedFirst"
|
372
|
+
zf = ::Zip::File.new(TEST_ZIP.zip_name)
|
373
|
+
oldName = zf.entries.first
|
374
|
+
zf.rename(oldName, newName)
|
375
|
+
io = ::StringIO.new('')
|
376
|
+
buffer = zf.write_buffer(io)
|
377
|
+
File.open(TEST_ZIP.zip_name, 'wb') { |f| f.write buffer.string }
|
378
|
+
zfRead = ::Zip::File.new(TEST_ZIP.zip_name)
|
379
|
+
assert(zfRead.entries.detect { |e| e.name == newName } != nil)
|
380
|
+
assert(zfRead.entries.detect { |e| e.name == oldName } == nil)
|
381
|
+
zfRead.close
|
382
|
+
|
383
|
+
zf.close
|
384
|
+
end
|
385
|
+
|
386
|
+
# This test tests that after commit, you
|
387
|
+
# can delete the file you used to add the entry to the zip file
|
388
|
+
# with
|
389
|
+
def test_commitUseZipEntry
|
390
|
+
FileUtils.cp(TestFiles::RANDOM_ASCII_FILE1, OK_DELETE_FILE)
|
391
|
+
zf = ::Zip::File.open(TEST_ZIP.zip_name)
|
392
|
+
zf.add("okToDelete.txt", OK_DELETE_FILE)
|
393
|
+
assert_contains(zf, "okToDelete.txt")
|
394
|
+
zf.commit
|
395
|
+
File.rename(OK_DELETE_FILE, OK_DELETE_MOVED_FILE)
|
396
|
+
assert_contains(zf, "okToDelete.txt", OK_DELETE_MOVED_FILE)
|
397
|
+
end
|
398
|
+
|
399
|
+
# def test_close
|
400
|
+
# zf = ZipFile.new(TEST_ZIP.zip_name)
|
401
|
+
# zf.close
|
402
|
+
# assert_raises(IOError) {
|
403
|
+
# zf.extract(TEST_ZIP.entry_names.first, "hullubullu")
|
404
|
+
# }
|
405
|
+
# end
|
406
|
+
|
407
|
+
def test_compound1
|
408
|
+
renamedName = "renamedName"
|
409
|
+
originalEntries = []
|
410
|
+
filename_to_remove = ''
|
411
|
+
begin
|
412
|
+
zf = ::Zip::File.new(TEST_ZIP.zip_name)
|
413
|
+
originalEntries = zf.entries.dup
|
414
|
+
|
415
|
+
assert_not_contains(zf, TestFiles::RANDOM_ASCII_FILE1)
|
416
|
+
zf.add(TestFiles::RANDOM_ASCII_FILE1,
|
417
|
+
TestFiles::RANDOM_ASCII_FILE1)
|
418
|
+
assert_contains(zf, TestFiles::RANDOM_ASCII_FILE1)
|
419
|
+
|
420
|
+
entry_to_rename = zf.entries.find { |entry| entry.name.match('longAscii') }
|
421
|
+
zf.rename(entry_to_rename, renamedName)
|
422
|
+
assert_contains(zf, renamedName)
|
423
|
+
|
424
|
+
TestFiles::BINARY_TEST_FILES.each {
|
425
|
+
|filename|
|
426
|
+
zf.add(filename, filename)
|
427
|
+
assert_contains(zf, filename)
|
428
|
+
}
|
429
|
+
|
430
|
+
assert_contains(zf, originalEntries.last.to_s)
|
431
|
+
filename_to_remove = originalEntries.map(&:to_s).find { |name| name.match('longBinary') }
|
432
|
+
zf.remove(filename_to_remove)
|
433
|
+
assert_not_contains(zf, filename_to_remove)
|
434
|
+
|
435
|
+
ensure
|
436
|
+
zf.close
|
437
|
+
end
|
438
|
+
begin
|
439
|
+
zfRead = ::Zip::File.new(TEST_ZIP.zip_name)
|
440
|
+
assert_contains(zfRead, TestFiles::RANDOM_ASCII_FILE1)
|
441
|
+
assert_contains(zfRead, renamedName)
|
442
|
+
TestFiles::BINARY_TEST_FILES.each {
|
443
|
+
|filename|
|
444
|
+
assert_contains(zfRead, filename)
|
445
|
+
}
|
446
|
+
assert_not_contains(zfRead, filename_to_remove)
|
447
|
+
ensure
|
448
|
+
zfRead.close
|
449
|
+
end
|
450
|
+
end
|
451
|
+
|
452
|
+
def test_compound2
|
453
|
+
begin
|
454
|
+
zf = ::Zip::File.new(TEST_ZIP.zip_name)
|
455
|
+
originalEntries = zf.entries.dup
|
456
|
+
|
457
|
+
originalEntries.each {
|
458
|
+
|entry|
|
459
|
+
zf.remove(entry)
|
460
|
+
assert_not_contains(zf, entry)
|
461
|
+
}
|
462
|
+
assert(zf.entries.empty?)
|
463
|
+
|
464
|
+
TestFiles::ASCII_TEST_FILES.each {
|
465
|
+
|filename|
|
466
|
+
zf.add(filename, filename)
|
467
|
+
assert_contains(zf, filename)
|
468
|
+
}
|
469
|
+
assert_equal(zf.entries.sort.map { |e| e.name }, TestFiles::ASCII_TEST_FILES)
|
470
|
+
|
471
|
+
zf.rename(TestFiles::ASCII_TEST_FILES[0], "newName")
|
472
|
+
assert_not_contains(zf, TestFiles::ASCII_TEST_FILES[0])
|
473
|
+
assert_contains(zf, "newName")
|
474
|
+
ensure
|
475
|
+
zf.close
|
476
|
+
end
|
477
|
+
begin
|
478
|
+
zfRead = ::Zip::File.new(TEST_ZIP.zip_name)
|
479
|
+
asciiTestFiles = TestFiles::ASCII_TEST_FILES.dup
|
480
|
+
asciiTestFiles.shift
|
481
|
+
asciiTestFiles.each {
|
482
|
+
|filename|
|
483
|
+
assert_contains(zf, filename)
|
484
|
+
}
|
485
|
+
|
486
|
+
assert_contains(zf, "newName")
|
487
|
+
ensure
|
488
|
+
zfRead.close
|
489
|
+
end
|
490
|
+
end
|
491
|
+
|
492
|
+
def test_changeComment
|
493
|
+
::Zip::File.open(TEST_ZIP.zip_name) do |zf|
|
494
|
+
zf.comment = "my changed comment"
|
495
|
+
end
|
496
|
+
zfRead = ::Zip::File.open(TEST_ZIP.zip_name)
|
497
|
+
assert_equal("my changed comment", zfRead.comment)
|
498
|
+
end
|
499
|
+
|
500
|
+
def test_preserve_file_order
|
501
|
+
entryNames = nil
|
502
|
+
::Zip::File.open(TEST_ZIP.zip_name) {
|
503
|
+
|zf|
|
504
|
+
entryNames = zf.entries.map { |e| e.to_s }
|
505
|
+
zf.get_output_stream("a.txt") { |os| os.write "this is a.txt" }
|
506
|
+
zf.get_output_stream("z.txt") { |os| os.write "this is z.txt" }
|
507
|
+
zf.get_output_stream("k.txt") { |os| os.write "this is k.txt" }
|
508
|
+
entryNames << "a.txt" << "z.txt" << "k.txt"
|
509
|
+
}
|
510
|
+
|
511
|
+
::Zip::File.open(TEST_ZIP.zip_name) {
|
512
|
+
|zf|
|
513
|
+
assert_equal(entryNames, zf.entries.map { |e| e.to_s })
|
514
|
+
entries = zf.entries.sort_by { |e| e.name }.reverse
|
515
|
+
entries.each {
|
516
|
+
|e|
|
517
|
+
zf.remove e
|
518
|
+
zf.get_output_stream(e) { |os| os.write "foo" }
|
519
|
+
}
|
520
|
+
entryNames = entries.map { |e| e.to_s }
|
521
|
+
}
|
522
|
+
::Zip::File.open(TEST_ZIP.zip_name) {
|
523
|
+
|zf|
|
524
|
+
assert_equal(entryNames, zf.entries.map { |e| e.to_s })
|
525
|
+
}
|
526
|
+
end
|
527
|
+
|
528
|
+
def test_streaming
|
529
|
+
fname = ::File.join(::File.expand_path(::File.dirname(__FILE__)), "../README.md")
|
530
|
+
zname = "test/data/generated/README.zip"
|
531
|
+
Zip::File.open(zname, Zip::File::CREATE) do |zipfile|
|
532
|
+
zipfile.get_output_stream(File.basename(fname)) do |f|
|
533
|
+
f.puts File.read(fname)
|
534
|
+
end
|
535
|
+
end
|
536
|
+
|
537
|
+
data = nil
|
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
|
544
|
+
end
|
545
|
+
end
|
546
|
+
assert data
|
547
|
+
assert data =~ /Simonov/
|
548
|
+
end
|
549
|
+
|
550
|
+
private
|
551
|
+
def assert_contains(zf, entryName, filename = entryName)
|
552
|
+
assert(zf.entries.detect { |e| e.name == entryName } != nil, "entry #{entryName} not in #{zf.entries.join(', ')} in zip file #{zf}")
|
553
|
+
assert_entryContents(zf, entryName, filename) if File.exist?(filename)
|
554
|
+
end
|
555
|
+
|
556
|
+
def assert_not_contains(zf, entryName)
|
557
|
+
assert(zf.entries.detect { |e| e.name == entryName } == nil, "entry #{entryName} in #{zf.entries.join(', ')} in zip file #{zf}")
|
558
|
+
end
|
559
|
+
end
|