mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
b957c3dbcb
This changes "test/rubygems/test_case.rb" to "test/rubygems/helper.rb",
and "test/rubygems/test_utilities.rb" to "test/rubygems/utilities.rb".
The two files are a helper for tests, not test files. However, a file
starting with "test_" prefix is handled as a test file directly loaded
by test-unit because Rakefile specifies:
```
t.test_files = FileList['test/**/test_*.rb']
```
Directly loading test/rubygems/test_utilities.rb caused "uninitialized
constant Gem::TestCase". This issue was fixed by
59c6820971
, but the fix caused a
"circular require" warning because test_utilities.rb and test_case.rb
are now requiring each other.
Anyway, adding "test_" prefix to a test helper file is confusing, so
this changeset reverts the fix and solve the issue by renaming them.
https://github.com/rubygems/rubygems/commit/6460e018df
81 lines
1.8 KiB
Ruby
81 lines
1.8 KiB
Ruby
# frozen_string_literal: true
|
|
require_relative 'helper'
|
|
|
|
class TestGemResolverVendorSpecification < Gem::TestCase
|
|
def setup
|
|
super
|
|
|
|
@set = Gem::Resolver::VendorSet.new
|
|
@spec = Gem::Specification.new 'a', 1
|
|
end
|
|
|
|
def test_equals2
|
|
v_spec_a = Gem::Resolver::VendorSpecification.new @set, @spec
|
|
|
|
assert_equal v_spec_a, v_spec_a
|
|
|
|
spec_b = Gem::Specification.new 'b', 1
|
|
v_spec_b = Gem::Resolver::VendorSpecification.new @set, spec_b
|
|
|
|
refute_equal v_spec_a, v_spec_b
|
|
|
|
v_set = Gem::Resolver::VendorSet.new
|
|
v_spec_s = Gem::Resolver::VendorSpecification.new v_set, @spec
|
|
|
|
refute_equal v_spec_a, v_spec_s
|
|
|
|
i_set = Gem::Resolver::IndexSet.new
|
|
source = Gem::Source.new @gem_repo
|
|
i_spec = Gem::Resolver::IndexSpecification.new(
|
|
i_set, 'a', v(1), source, Gem::Platform::RUBY)
|
|
|
|
refute_equal v_spec_a, i_spec
|
|
end
|
|
|
|
def test_dependencies
|
|
@spec.add_dependency 'b'
|
|
@spec.add_dependency 'c'
|
|
|
|
v_spec = Gem::Resolver::VendorSpecification.new @set, @spec
|
|
|
|
assert_equal [dep('b'), dep('c')], v_spec.dependencies
|
|
end
|
|
|
|
def test_full_name
|
|
v_spec = Gem::Resolver::VendorSpecification.new @set, @spec
|
|
|
|
assert_equal 'a-1', v_spec.full_name
|
|
end
|
|
|
|
def test_install
|
|
spec = Gem::Resolver::VendorSpecification.new @set, @spec
|
|
|
|
called = :junk
|
|
|
|
spec.install({}) do |installer|
|
|
called = installer
|
|
end
|
|
|
|
assert_nil called
|
|
end
|
|
|
|
def test_name
|
|
v_spec = Gem::Resolver::VendorSpecification.new @set, @spec
|
|
|
|
assert_equal 'a', v_spec.name
|
|
end
|
|
|
|
def test_platform
|
|
v_spec = Gem::Resolver::VendorSpecification.new @set, @spec
|
|
|
|
assert_equal Gem::Platform::RUBY, v_spec.platform
|
|
end
|
|
|
|
def test_version
|
|
spec = Gem::Specification.new 'a', 1
|
|
|
|
v_spec = Gem::Resolver::VendorSpecification.new @set, spec
|
|
|
|
assert_equal v(1), v_spec.version
|
|
end
|
|
end
|