2 # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
4 # See LICENSE.txt for permissions.
7 require File.join(File.expand_path(File.dirname(__FILE__)),
8 'gem_package_tar_test_case')
9 require 'rubygems/package'
11 class TestGemPackageTarReader < TarTestCase
14 tar = tar_dir_header "foo", "bar", 0
15 tar << tar_file_header("bar", "baz", 0, 0)
21 Gem::Package::TarReader.new io do |tar_reader|
22 tar_reader.each_entry do |entry|
23 assert_kind_of Gem::Package::TarReader::Entry, entry
29 assert_equal 2, entries
33 content = ('a'..'z').to_a.join(" ")
35 str = tar_file_header("lib/foo", "", 010644, content.size) + content +
36 "\0" * (512 - content.size)
39 Gem::Package::TarReader.new(TempIO.new(str)) do |tar_reader|
43 tar_reader.each_entry do |entry|
44 assert_equal(content, entry.read)