Sha256: f007a67904c1907c52d6a3df9321563829d879cfbabd1d795d066cdd755d19eb

Contents?: true

Size: 1.43 KB

Versions: 21

Compression:

Stored size: 1.43 KB

Contents

require 'test_helper'
require 'zip/filesystem'

class ZipFsFileStatTest < MiniTest::Test
  def setup
    @zip_file = ::Zip::File.new('test/data/zipWithDirs.zip')
  end

  def teardown
    @zip_file.close if @zip_file
  end

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

  def test_ino
    assert_equal(0, @zip_file.file.stat('file1').ino)
  end

  def test_uid
    assert_equal(0, @zip_file.file.stat('file1').uid)
  end

  def test_gid
    assert_equal(0, @zip_file.file.stat('file1').gid)
  end

  def test_ftype
    assert_equal('file', @zip_file.file.stat('file1').ftype)
    assert_equal('directory', @zip_file.file.stat('dir1').ftype)
  end

  def test_mode
    assert_equal(0o600, @zip_file.file.stat('file1').mode & 0o777)
    assert_equal(0o600, @zip_file.file.stat('file1').mode & 0o777)
    assert_equal(0o755, @zip_file.file.stat('dir1').mode & 0o777)
    assert_equal(0o755, @zip_file.file.stat('dir1').mode & 0o777)
  end

  def test_dev
    assert_equal(0, @zip_file.file.stat('file1').dev)
  end

  def test_rdev
    assert_equal(0, @zip_file.file.stat('file1').rdev)
  end

  def test_rdev_major
    assert_equal(0, @zip_file.file.stat('file1').rdev_major)
  end

  def test_rdev_minor
    assert_equal(0, @zip_file.file.stat('file1').rdev_minor)
  end

  def test_nlink
    assert_equal(1, @zip_file.file.stat('file1').nlink)
  end

  def test_blksize
    assert_nil(@zip_file.file.stat('file1').blksize)
  end
end

Version data entries

21 entries across 17 versions & 3 rubygems

Version Path
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.7.0/gems/rubyzip-1.3.0/test/filesystem/file_stat_test.rb
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.6.0/gems/rubyzip-1.2.3/test/filesystem/file_stat_test.rb
vagrant-unbundled-2.2.6.2 vendor/bundle/ruby/2.6.0/gems/rubyzip-1.2.4/test/filesystem/file_stat_test.rb
vagrant-unbundled-2.2.6.1 vendor/bundle/ruby/2.6.0/gems/rubyzip-1.2.4/test/filesystem/file_stat_test.rb
vagrant-unbundled-2.2.6.0 vendor/bundle/ruby/2.6.0/gems/rubyzip-1.2.4/test/filesystem/file_stat_test.rb
rubyzip-1.3.0 test/filesystem/file_stat_test.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.6.0/gems/rubyzip-1.2.2/test/filesystem/file_stat_test.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.5.0/gems/rubyzip-1.2.2/test/filesystem/file_stat_test.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.6.0/gems/rubyzip-1.2.4/test/filesystem/file_stat_test.rb
rubyzip-1.2.4 test/filesystem/file_stat_test.rb
rubyzip-1.2.3 test/filesystem/file_stat_test.rb
tdiary-5.0.13 vendor/bundle/gems/rubyzip-1.2.2/test/filesystem/file_stat_test.rb
tdiary-5.0.12.1 vendor/bundle/gems/rubyzip-1.2.2/test/filesystem/file_stat_test.rb
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.5.0/gems/rubyzip-1.2.2/test/filesystem/file_stat_test.rb
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.6.0/gems/rubyzip-1.2.2/test/filesystem/file_stat_test.rb
vagrant-unbundled-2.2.3.0 vendor/bundle/ruby/2.5.0/gems/rubyzip-1.2.2/test/filesystem/file_stat_test.rb
tdiary-5.0.11 vendor/bundle/gems/rubyzip-1.2.2/test/filesystem/file_stat_test.rb
vagrant-unbundled-2.2.2.0 vendor/bundle/ruby/2.5.0/gems/rubyzip-1.2.2/test/filesystem/file_stat_test.rb
vagrant-unbundled-2.2.0.0 vendor/bundle/ruby/2.5.0/gems/rubyzip-1.2.2/test/filesystem/file_stat_test.rb
vagrant-unbundled-2.1.4.0 vendor/bundle/ruby/2.5.0/gems/rubyzip-1.2.2/test/filesystem/file_stat_test.rb