From eb807d42eca121df22f72b95465bba52a4e7fefa Mon Sep 17 00:00:00 2001 From: matz Date: Mon, 7 Mar 2011 08:39:39 +0000 Subject: * gc.c (rb_gc_set_params): allow GC parameter configuration by environment variables. based on a patch from funny-falcon at https://gist.github.com/856296, but honors safe level. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/rubygems/test_gem_specification.rb | 118 +++++++------------------------- 1 file changed, 25 insertions(+), 93 deletions(-) (limited to 'test/rubygems/test_gem_specification.rb') diff --git a/test/rubygems/test_gem_specification.rb b/test/rubygems/test_gem_specification.rb index f820d7c1c3..49862fe4bb 100644 --- a/test/rubygems/test_gem_specification.rb +++ b/test/rubygems/test_gem_specification.rb @@ -46,7 +46,6 @@ end def setup super - # TODO: there is no reason why the spec tests need to write to disk @a1 = quick_gem 'a', '1' do |s| s.executable = 'exec' s.extensions << 'ext/a/extconf.rb' @@ -168,13 +167,6 @@ end Gem::Specification.normalize_yaml_input(StringIO.new(input)) end - def test_self_normalize_yaml_input_with_192_yaml - input = "--- !ruby/object:Gem::Specification \nblah: !!null \n" - expected = "--- !ruby/object:Gem::Specification \nblah: \n" - - assert_equal expected, Gem::Specification.normalize_yaml_input(input) - end - def test_initialize spec = Gem::Specification.new do |s| s.name = "blah" @@ -302,7 +294,7 @@ end end def test_add_dependency_with_explicit_type - gem = quick_spec "awesome", "1.0" do |awesome| + gem = quick_gem "awesome", "1.0" do |awesome| awesome.add_development_dependency "monkey" end @@ -379,19 +371,18 @@ end assert_equal [rake, jabber, pqa], @a1.dependencies end - def test_dependencies - util_setup_deps - assert_equal [@bonobo, @monkey], @gem.dependencies - end + def test_dependencies_scoped_by_type + gem = quick_gem "awesome", "1.0" do |awesome| + awesome.add_runtime_dependency "bonobo", [] + awesome.add_development_dependency "monkey", [] + end - def test_runtime_dependencies - util_setup_deps - assert_equal [@bonobo], @gem.runtime_dependencies - end + bonobo = Gem::Dependency.new("bonobo", []) + monkey = Gem::Dependency.new("monkey", [], :development) - def test_development_dependencies - util_setup_deps - assert_equal [@monkey], @gem.development_dependencies + assert_equal([bonobo, monkey], gem.dependencies) + assert_equal([bonobo], gem.runtime_dependencies) + assert_equal([monkey], gem.development_dependencies) end def test_description @@ -399,8 +390,8 @@ end end def test_eql_eh - g1 = quick_spec 'gem' - g2 = quick_spec 'gem' + g1 = quick_gem 'gem' + g2 = quick_gem 'gem' assert_equal g1, g2 assert_equal g1.hash, g2.hash @@ -699,7 +690,7 @@ end end def test_prerelease_spec_adds_required_rubygems_version - @prerelease = quick_spec('tardis', '2.2.0.a') + @prerelease = quick_gem('tardis', '2.2.0.a') refute @prerelease.required_rubygems_version.satisfied_by?(Gem::Version.new('1.3.1')) assert @prerelease.required_rubygems_version.satisfied_by?(Gem::Version.new('1.4.0')) end @@ -725,8 +716,8 @@ end end def test_spaceship_name - s1 = quick_spec 'a', '1' - s2 = quick_spec 'b', '1' + s1 = quick_gem 'a', '1' + s2 = quick_gem 'b', '1' assert_equal(-1, (s1 <=> s2)) assert_equal( 0, (s1 <=> s1)) @@ -734,8 +725,8 @@ end end def test_spaceship_platform - s1 = quick_spec 'a', '1' - s2 = quick_spec 'a', '1' do |s| + s1 = quick_gem 'a', '1' + s2 = quick_gem 'a', '1' do |s| s.platform = Gem::Platform.new 'x86-my_platform1' end @@ -745,8 +736,8 @@ end end def test_spaceship_version - s1 = quick_spec 'a', '1' - s2 = quick_spec 'a', '2' + s1 = quick_gem 'a', '1' + s2 = quick_gem 'a', '2' assert_equal( -1, (s1 <=> s2)) assert_equal( 0, (s1 <=> s1)) @@ -812,54 +803,6 @@ end assert_equal @a2, same_spec end - def test_to_ruby_for_cache - @a2.add_runtime_dependency 'b', '1' - @a2.dependencies.first.instance_variable_set :@type, nil - @a2.required_rubygems_version = Gem::Requirement.new '> 0' - - # cached specs do not have spec.files populated: - ruby_code = @a2.to_ruby_for_cache - - expected = <<-SPEC -# -*- encoding: utf-8 -*- - -Gem::Specification.new do |s| - s.name = %q{a} - s.version = \"2\" - - s.required_rubygems_version = Gem::Requirement.new(\"> 0\") if s.respond_to? :required_rubygems_version= - s.authors = [\"A User\"] - s.date = %q{#{Gem::Specification::TODAY.strftime "%Y-%m-%d"}} - s.description = %q{This is a test description} - s.email = %q{example@example.com} - s.homepage = %q{http://example.com} - s.require_paths = [\"lib\"] - s.rubygems_version = %q{#{Gem::VERSION}} - s.summary = %q{this is a summary} - - if s.respond_to? :specification_version then - s.specification_version = #{Gem::Specification::CURRENT_SPECIFICATION_VERSION} - - if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then - s.add_runtime_dependency(%q, [\"= 1\"]) - else - s.add_dependency(%q, [\"= 1\"]) - end - else - s.add_dependency(%q, [\"= 1\"]) - end -end - SPEC - - assert_equal expected, ruby_code - - same_spec = eval ruby_code - - # cached specs do not have spec.files populated: - @a2.files = [] - assert_equal @a2, same_spec - end - def test_to_ruby_fancy @a1.platform = Gem::Platform.local ruby_code = @a1.to_ruby @@ -899,16 +842,16 @@ Gem::Specification.new do |s| if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then s.add_runtime_dependency(%q, [\"> 0.4\"]) s.add_runtime_dependency(%q, [\"> 0.0.0\"]) - s.add_runtime_dependency(%q, [\"<= 0.6\", \"> 0.4\"]) + s.add_runtime_dependency(%q, [\"> 0.4\", \"<= 0.6\"]) else s.add_dependency(%q, [\"> 0.4\"]) s.add_dependency(%q, [\"> 0.0.0\"]) - s.add_dependency(%q, [\"<= 0.6\", \"> 0.4\"]) + s.add_dependency(%q, [\"> 0.4\", \"<= 0.6\"]) end else s.add_dependency(%q, [\"> 0.4\"]) s.add_dependency(%q, [\"> 0.0.0\"]) - s.add_dependency(%q, [\"<= 0.6\", \"> 0.4\"]) + s.add_dependency(%q, [\"> 0.4\", \"<= 0.6\"]) end end SPEC @@ -941,9 +884,6 @@ end def test_to_yaml yaml_str = @a1.to_yaml - - refute_match '!!null', yaml_str - same_spec = YAML.load(yaml_str) assert_equal @a1, same_spec @@ -1318,16 +1258,6 @@ end specfile.delete end - def util_setup_deps - @gem = quick_spec "awesome", "1.0" do |awesome| - awesome.add_runtime_dependency "bonobo", [] - awesome.add_development_dependency "monkey", [] - end - - @bonobo = Gem::Dependency.new("bonobo", []) - @monkey = Gem::Dependency.new("monkey", [], :development) - end - def util_setup_validate Dir.chdir @tempdir do FileUtils.mkdir_p File.join('ext', 'a') @@ -1339,4 +1269,6 @@ end FileUtils.touch File.join('test', 'suite.rb') end end + end + -- cgit v1.2.3