Sha256: a1abd28d5f3f89f0706a8f0b3f176cb837f45317a06200df0ebb32d488e6b69f

Contents?: true

Size: 1.67 KB

Versions: 72

Compression:

Stored size: 1.67 KB

Contents

if ENV['FULL_ZIP64_TEST']
  require 'minitest/autorun'
  require 'minitest/unit'
  require 'fileutils'
  require 'zip'

# test zip64 support for real, by actually exceeding the 32-bit size/offset limits
# this test does not, of course, run with the normal unit tests! ;)

  class Zip64FullTest < MiniTest::Test
    def teardown
      ::Zip.reset!
    end

    def prepareTestFile(test_filename)
      ::File.delete(test_filename) if ::File.exist?(test_filename)
      return test_filename
    end

    def test_largeZipFile
      ::Zip.write_zip64_support = true
      first_text = 'starting out small'
      last_text = 'this tests files starting after 4GB in the archive'
      test_filename = prepareTestFile('huge.zip')
      ::Zip::OutputStream.open(test_filename) do |io|
        io.put_next_entry('first_file.txt')
        io.write(first_text)

        # write just over 4GB (stored, so the zip file exceeds 4GB)
        buf = 'blah' * 16384
        io.put_next_entry('huge_file', nil, nil, ::Zip::Entry::STORED)
        65537.times { io.write(buf) }

        io.put_next_entry('last_file.txt')
        io.write(last_text)
      end

      ::Zip::File.open(test_filename) do |zf|
        assert_equal %w(first_file.txt huge_file last_file.txt), zf.entries.map(&:name)
        assert_equal first_text, zf.read('first_file.txt')
        assert_equal last_text, zf.read('last_file.txt')
      end

      # note: if this fails, be sure you have UnZip version 6.0 or newer
      # as this is the first version to support zip64 extensions
      # but some OSes (*cough* OSX) still bundle a 5.xx release
      assert system("unzip -t #{test_filename}"), "third-party zip validation failed"
    end

  end

end

Version data entries

72 entries across 69 versions & 20 rubygems

Version Path
logstash-output-scalyr-0.2.1.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/test/zip64_full_test.rb
logstash-output-scalyr-0.2.0 vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/test/zip64_full_test.rb
logstash-output-scalyr-0.2.0.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/test/zip64_full_test.rb
logstash-output-scalyr-0.1.26.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/test/zip64_full_test.rb
logstash-output-scalyr-0.1.25.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/test/zip64_full_test.rb
logstash-output-scalyr-0.1.24.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/test/zip64_full_test.rb
logstash-output-scalyr-0.1.23.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/test/zip64_full_test.rb
logstash-output-scalyr-0.1.22.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/test/zip64_full_test.rb
logstash-output-scalyr-0.1.21.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/test/zip64_full_test.rb
logstash-output-scalyr-0.1.20.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/test/zip64_full_test.rb
logstash-output-scalyr-0.1.19.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/test/zip64_full_test.rb
logstash-output-scalyr-0.1.18.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/test/zip64_full_test.rb
logstash-output-scalyr-0.1.17.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/test/zip64_full_test.rb
logstash-output-scalyr-0.1.16.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/test/zip64_full_test.rb
logstash-output-scalyr-0.1.15.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/test/zip64_full_test.rb
logstash-output-scalyr-0.1.14.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/test/zip64_full_test.rb
logstash-output-scalyr-0.1.13 vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/test/zip64_full_test.rb
logstash-output-scalyr-0.1.12 vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/test/zip64_full_test.rb
logstash-output-scalyr-0.1.11.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/test/zip64_full_test.rb
logstash-output-scalyr-0.1.10.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/test/zip64_full_test.rb