diff options
Diffstat (limited to 'test/rubygems/test_gem_specification.rb')
-rw-r--r-- | test/rubygems/test_gem_specification.rb | 51 |
1 files changed, 45 insertions, 6 deletions
diff --git a/test/rubygems/test_gem_specification.rb b/test/rubygems/test_gem_specification.rb index 5979890aeb..97e2615fe2 100644 --- a/test/rubygems/test_gem_specification.rb +++ b/test/rubygems/test_gem_specification.rb @@ -473,6 +473,31 @@ end assert_equal expected, @a1.files.sort end + def test_files_append + @a1.files = %w(files bin/common) + @a1.test_files = %w(test_files bin/common) + @a1.executables = %w(executables common) + @a1.extra_rdoc_files = %w(extra_rdoc_files bin/common) + @a1.extensions = %w(extensions bin/common) + + expected = %w[ + bin/common + bin/executables + extensions + extra_rdoc_files + files + test_files + ] + assert_equal expected, @a1.files.sort + + @a1.files << "generated_file.c" + + expected << "generated_file.c" + expected.sort! + + assert_equal expected, @a1.files.sort + end + def test_files_duplicate @a2.files = %w[a b c d b] @a2.extra_rdoc_files = %w[x y z x] @@ -748,14 +773,14 @@ Gem::Specification.new do |s| s.files = [\"lib/code.rb\"] s.homepage = %q{http://example.com} s.require_paths = [\"lib\"] - s.rubygems_version = %q{#{Gem::RubyGemsVersion}} + s.rubygems_version = %q{#{Gem::VERSION}} s.summary = %q{this is a summary} if s.respond_to? :specification_version then current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION s.specification_version = #{Gem::Specification::CURRENT_SPECIFICATION_VERSION} - if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then + if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then s.add_runtime_dependency(%q<b>, [\"= 1\"]) else s.add_dependency(%q<b>, [\"= 1\"]) @@ -802,7 +827,7 @@ Gem::Specification.new do |s| s.require_paths = [\"lib\"] s.requirements = [\"A working computer\"] s.rubyforge_project = %q{example} - s.rubygems_version = %q{#{Gem::RubyGemsVersion}} + s.rubygems_version = %q{#{Gem::VERSION}} s.summary = %q{this is a summary} s.test_files = [\"test/suite.rb\"] @@ -810,7 +835,7 @@ Gem::Specification.new do |s| current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION s.specification_version = 3 - if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then + if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then s.add_runtime_dependency(%q<rake>, [\"> 0.4\"]) s.add_runtime_dependency(%q<jabber4r>, [\"> 0.0.0\"]) s.add_runtime_dependency(%q<pqa>, [\"> 0.4\", \"<= 0.6\"]) @@ -883,7 +908,7 @@ end yaml_str = @a1.to_yaml - same_spec = YAML.load(yaml_str) + same_spec = YAML.load yaml_str assert_equal Gem::Platform.new('powerpc-darwin7'), same_spec.platform assert_equal 'powerpc-darwin7.9.0', same_spec.original_platform @@ -1173,7 +1198,7 @@ end @a1.validate end - assert_equal "expected RubyGems version #{Gem::RubyGemsVersion}, was 3", + assert_equal "expected RubyGems version #{Gem::VERSION}, was 3", e.message end @@ -1228,6 +1253,20 @@ end assert_equal Gem::Version.new('1'), @a1.version end + def test_load_errors_contain_filename + specfile = Tempfile.new(self.class.name.downcase) + specfile.write "raise 'boom'" + specfile.close + begin + Gem::Specification.load(specfile.path) + rescue => e + name_rexp = Regexp.new(Regexp.escape(specfile.path)) + assert e.backtrace.grep(name_rexp).any? + end + ensure + specfile.delete + end + def util_setup_validate Dir.chdir @tempdir do FileUtils.mkdir_p File.join('ext', 'a') |