diff options
author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2023-04-13 14:49:33 +0900 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-04-13 08:38:45 +0000 |
commit | 1f0974e654bf3c8a7dd321ae898174d942975686 (patch) | |
tree | db698b0ab05251291767d7574d8e574f244a15c4 /test | |
parent | 80fa9b04042bd28f9c02364547de4e2f6f408bdd (diff) | |
download | ruby-1f0974e654bf3c8a7dd321ae898174d942975686.tar.gz |
[rubygems/rubygems] Downcase camel like cases of instance variable
https://github.com/rubygems/rubygems/commit/4eaac27107
Diffstat (limited to 'test')
-rw-r--r-- | test/rubygems/bundler_test_gem.rb | 16 | ||||
-rw-r--r-- | test/rubygems/helper.rb | 42 | ||||
-rw-r--r-- | test/rubygems/test_gem.rb | 6 | ||||
-rw-r--r-- | test/rubygems/test_gem_command.rb | 16 | ||||
-rw-r--r-- | test/rubygems/test_gem_ext_builder.rb | 4 | ||||
-rw-r--r-- | test/rubygems/test_gem_ext_ext_conf_builder.rb | 6 | ||||
-rw-r--r-- | test/rubygems/test_gem_installer.rb | 14 | ||||
-rw-r--r-- | test/rubygems/test_gem_platform.rb | 6 | ||||
-rw-r--r-- | test/rubygems/test_gem_request.rb | 12 | ||||
-rw-r--r-- | test/rubygems/test_gem_resolver.rb | 28 | ||||
-rw-r--r-- | test/rubygems/test_gem_source.rb | 10 |
11 files changed, 80 insertions, 80 deletions
diff --git a/test/rubygems/bundler_test_gem.rb b/test/rubygems/bundler_test_gem.rb index 3cd6e7acc5..78adfc94c5 100644 --- a/test/rubygems/bundler_test_gem.rb +++ b/test/rubygems/bundler_test_gem.rb @@ -138,15 +138,15 @@ class TestBundlerGem < Gem::TestCase ENV["GEM_PATH"] = path with_rubygems_gemdeps("-") do - new_PATH = [File.join(path, "bin"), ENV["PATH"]].join(File::PATH_SEPARATOR) - new_RUBYOPT = "-I#{rubygems_path} -I#{bundler_path}" + new_path = [File.join(path, "bin"), ENV["PATH"]].join(File::PATH_SEPARATOR) + new_rubyopt = "-I#{rubygems_path} -I#{bundler_path}" path = File.join @tempdir, "gem.deps.rb" File.open path, "w" do |f| f.puts "gem 'a'" end - out0 = with_path_and_rubyopt(new_PATH, new_RUBYOPT) do + out0 = with_path_and_rubyopt(new_path, new_rubyopt) do IO.popen("foo", &:read).split(/\n/) end @@ -154,7 +154,7 @@ class TestBundlerGem < Gem::TestCase f.puts "gem 'b'" f.puts "gem 'c'" end - out = with_path_and_rubyopt(new_PATH, new_RUBYOPT) do + out = with_path_and_rubyopt(new_path, new_rubyopt) do IO.popen("foo", &:read).split(/\n/) end @@ -192,15 +192,15 @@ class TestBundlerGem < Gem::TestCase with_rubygems_gemdeps("-") do Dir.mkdir "sub1" - new_PATH = [File.join(path, "bin"), ENV["PATH"]].join(File::PATH_SEPARATOR) - new_RUBYOPT = "-I#{rubygems_path} -I#{bundler_path}" + new_path = [File.join(path, "bin"), ENV["PATH"]].join(File::PATH_SEPARATOR) + new_rubyopt = "-I#{rubygems_path} -I#{bundler_path}" path = File.join @tempdir, "gem.deps.rb" File.open path, "w" do |f| f.puts "gem 'a'" end - out0 = with_path_and_rubyopt(new_PATH, new_RUBYOPT) do + out0 = with_path_and_rubyopt(new_path, new_rubyopt) do IO.popen("foo", :chdir => "sub1", &:read).split(/\n/) end @@ -208,7 +208,7 @@ class TestBundlerGem < Gem::TestCase f.puts "gem 'b'" f.puts "gem 'c'" end - out = with_path_and_rubyopt(new_PATH, new_RUBYOPT) do + out = with_path_and_rubyopt(new_path, new_rubyopt) do IO.popen("foo", :chdir => "sub1", &:read).split(/\n/) end diff --git a/test/rubygems/helper.rb b/test/rubygems/helper.rb index 9ed26ce011..442f377891 100644 --- a/test/rubygems/helper.rb +++ b/test/rubygems/helper.rb @@ -308,7 +308,7 @@ class Gem::TestCase < Test::Unit::TestCase # capture output Gem::DefaultUserInteraction.ui = Gem::MockGemUi.new - @orig_SYSTEM_WIDE_CONFIG_FILE = Gem::ConfigFile::SYSTEM_WIDE_CONFIG_FILE + @orig_system_wide_config_file = Gem::ConfigFile::SYSTEM_WIDE_CONFIG_FILE Gem::ConfigFile.send :remove_const, :SYSTEM_WIDE_CONFIG_FILE Gem::ConfigFile.send :const_set, :SYSTEM_WIDE_CONFIG_FILE, File.join(@tempdir, "system-gemrc") @@ -329,7 +329,7 @@ class Gem::TestCase < Test::Unit::TestCase Gem.ensure_gem_subdirectories @gemhome Gem.ensure_default_gem_subdirectories @gemhome - @orig_LOAD_PATH = $LOAD_PATH.dup + @orig_load_path = $LOAD_PATH.dup $LOAD_PATH.map! do |s| expand_path = begin File.realpath(s) @@ -415,7 +415,7 @@ class Gem::TestCase < Test::Unit::TestCase end @marshal_version = "#{Marshal::MAJOR_VERSION}.#{Marshal::MINOR_VERSION}" - @orig_LOADED_FEATURES = $LOADED_FEATURES.dup + @orig_loaded_features = $LOADED_FEATURES.dup end ## @@ -423,14 +423,14 @@ class Gem::TestCase < Test::Unit::TestCase # tempdir def teardown - $LOAD_PATH.replace @orig_LOAD_PATH if @orig_LOAD_PATH - if @orig_LOADED_FEATURES - if @orig_LOAD_PATH - ($LOADED_FEATURES - @orig_LOADED_FEATURES).each do |feat| + $LOAD_PATH.replace @orig_load_path if @orig_load_path + if @orig_loaded_features + if @orig_load_path + ($LOADED_FEATURES - @orig_loaded_features).each do |feat| $LOADED_FEATURES.delete(feat) if feat.start_with?(@tmp) end else - $LOADED_FEATURES.replace @orig_LOADED_FEATURES + $LOADED_FEATURES.replace @orig_loaded_features end end @@ -448,7 +448,7 @@ class Gem::TestCase < Test::Unit::TestCase Gem::ConfigFile.send :remove_const, :SYSTEM_WIDE_CONFIG_FILE Gem::ConfigFile.send :const_set, :SYSTEM_WIDE_CONFIG_FILE, - @orig_SYSTEM_WIDE_CONFIG_FILE + @orig_system_wide_config_file Gem.ruby = @orig_ruby if @orig_ruby @@ -1084,12 +1084,12 @@ Also, a list: Gem.send :remove_instance_variable, :@ruby_version end - @RUBY_VERSION = RUBY_VERSION - @RUBY_PATCHLEVEL = RUBY_PATCHLEVEL - @RUBY_REVISION = RUBY_REVISION - @RUBY_DESCRIPTION = RUBY_DESCRIPTION - @RUBY_ENGINE = RUBY_ENGINE - @RUBY_ENGINE_VERSION = RUBY_ENGINE_VERSION + @ruby_version = RUBY_VERSION + @ruby_patchlevel = RUBY_PATCHLEVEL + @ruby_revision = RUBY_REVISION + @ruby_description = RUBY_DESCRIPTION + @ruby_engine = RUBY_ENGINE + @ruby_engine_version = RUBY_ENGINE_VERSION util_clear_RUBY_VERSION @@ -1104,12 +1104,12 @@ Also, a list: def util_restore_RUBY_VERSION util_clear_RUBY_VERSION - Object.const_set :RUBY_VERSION, @RUBY_VERSION - Object.const_set :RUBY_PATCHLEVEL, @RUBY_PATCHLEVEL - Object.const_set :RUBY_REVISION, @RUBY_REVISION - Object.const_set :RUBY_DESCRIPTION, @RUBY_DESCRIPTION - Object.const_set :RUBY_ENGINE, @RUBY_ENGINE - Object.const_set :RUBY_ENGINE_VERSION, @RUBY_ENGINE_VERSION + Object.const_set :RUBY_VERSION, @ruby_version + Object.const_set :RUBY_PATCHLEVEL, @ruby_patchlevel + Object.const_set :RUBY_REVISION, @ruby_revision + Object.const_set :RUBY_DESCRIPTION, @ruby_description + Object.const_set :RUBY_ENGINE, @ruby_engine + Object.const_set :RUBY_ENGINE_VERSION, @ruby_engine_version end def util_clear_RUBY_VERSION diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb index 39a4c329cd..126aad2602 100644 --- a/test/rubygems/test_gem.rb +++ b/test/rubygems/test_gem.rb @@ -1713,14 +1713,14 @@ class TestGem < Gem::TestCase def ruby_install_name(name) with_clean_path_to_ruby do - orig_RUBY_INSTALL_NAME = RbConfig::CONFIG["ruby_install_name"] + orig_ruby_install_name = RbConfig::CONFIG["ruby_install_name"] RbConfig::CONFIG["ruby_install_name"] = name begin yield ensure - if orig_RUBY_INSTALL_NAME - RbConfig::CONFIG["ruby_install_name"] = orig_RUBY_INSTALL_NAME + if orig_ruby_install_name + RbConfig::CONFIG["ruby_install_name"] = orig_ruby_install_name else RbConfig::CONFIG.delete "ruby_install_name" end diff --git a/test/rubygems/test_gem_command.rb b/test/rubygems/test_gem_command.rb index 98127f3e80..3d0f04830e 100644 --- a/test/rubygems/test_gem_command.rb +++ b/test/rubygems/test_gem_command.rb @@ -234,7 +234,7 @@ class TestGemCommand < Gem::TestCase WARNING: The \"--test\" option has been deprecated and will be removed in Rubygems 3.1. EXPECTED - testCommand = Class.new(Gem::Command) do + test_command = Class.new(Gem::Command) do def initialize super("test", "Gem::Command instance for testing") @@ -250,7 +250,7 @@ WARNING: The \"--test\" option has been deprecated and will be removed in Rubyg end end - cmd = testCommand.new + cmd = test_command.new use_ui @ui do cmd.invoke("--test") @@ -263,7 +263,7 @@ WARNING: The \"--test\" option has been deprecated and will be removed in Rubyg WARNING: The \"--test\" option has been deprecated and will be removed in future versions of Rubygems. EXPECTED - testCommand = Class.new(Gem::Command) do + test_command = Class.new(Gem::Command) do def initialize super("test", "Gem::Command instance for testing") @@ -279,7 +279,7 @@ WARNING: The \"--test\" option has been deprecated and will be removed in futur end end - cmd = testCommand.new + cmd = test_command.new use_ui @ui do cmd.invoke("--test") @@ -292,7 +292,7 @@ WARNING: The \"--test\" option has been deprecated and will be removed in futur WARNING: The \"--test\" option has been deprecated and will be removed in Rubygems 3.1. Whether you set `--test` mode or not, this dummy app always runs in test mode. EXPECTED - testCommand = Class.new(Gem::Command) do + test_command = Class.new(Gem::Command) do def initialize super("test", "Gem::Command instance for testing") @@ -308,7 +308,7 @@ WARNING: The \"--test\" option has been deprecated and will be removed in Rubyg end end - cmd = testCommand.new + cmd = test_command.new use_ui @ui do cmd.invoke("--test") @@ -321,7 +321,7 @@ WARNING: The \"--test\" option has been deprecated and will be removed in Rubyg WARNING: The \"--test\" option has been deprecated and will be removed in future versions of Rubygems. Whether you set `--test` mode or not, this dummy app always runs in test mode. EXPECTED - testCommand = Class.new(Gem::Command) do + test_command = Class.new(Gem::Command) do def initialize super("test", "Gem::Command instance for testing") @@ -337,7 +337,7 @@ WARNING: The \"--test\" option has been deprecated and will be removed in futur end end - cmd = testCommand.new + cmd = test_command.new use_ui @ui do cmd.invoke("--test") diff --git a/test/rubygems/test_gem_ext_builder.rb b/test/rubygems/test_gem_ext_builder.rb index 03d40fa400..14b470de97 100644 --- a/test/rubygems/test_gem_ext_builder.rb +++ b/test/rubygems/test_gem_ext_builder.rb @@ -6,7 +6,7 @@ require "rubygems/installer" class TestGemExtBuilder < Gem::TestCase def setup - @orig_DESTDIR = ENV["DESTDIR"] + @orig_destdir = ENV["DESTDIR"] @orig_make = ENV["make"] super @@ -23,7 +23,7 @@ class TestGemExtBuilder < Gem::TestCase def teardown super - ENV["DESTDIR"] = @orig_DESTDIR + ENV["DESTDIR"] = @orig_destdir ENV["make"] = @orig_make end diff --git a/test/rubygems/test_gem_ext_ext_conf_builder.rb b/test/rubygems/test_gem_ext_ext_conf_builder.rb index 7ce7c42653..018251ac06 100644 --- a/test/rubygems/test_gem_ext_ext_conf_builder.rb +++ b/test/rubygems/test_gem_ext_ext_conf_builder.rb @@ -65,11 +65,11 @@ class TestGemExtExtConfBuilder < Gem::TestCase end end - def test_class_build_env_MAKE + def test_class_build_env_make env_make = ENV.delete "make" ENV["make"] = nil - env_MAKE = ENV.delete "MAKE" + env_large_make = ENV.delete "MAKE" ENV["MAKE"] = "anothermake" if Gem.java_platform? @@ -91,7 +91,7 @@ class TestGemExtExtConfBuilder < Gem::TestCase assert_contains_make_command "clean", output[4] end ensure - ENV["MAKE"] = env_MAKE + ENV["MAKE"] = env_large_make ENV["make"] = env_make end diff --git a/test/rubygems/test_gem_installer.rb b/test/rubygems/test_gem_installer.rb index c4f107fd52..30113c629b 100644 --- a/test/rubygems/test_gem_installer.rb +++ b/test/rubygems/test_gem_installer.rb @@ -204,7 +204,7 @@ gem 'other', version bin_dir = bin_dir.downcase end - orig_PATH = ENV["PATH"] + orig_path = ENV["PATH"] ENV["PATH"] = [ENV["PATH"], bin_dir].join(File::PATH_SEPARATOR) use_ui @ui do @@ -215,7 +215,7 @@ gem 'other', version return unless Gem.win_platform? - ENV["PATH"] = [orig_PATH, bin_dir.tr(File::SEPARATOR, File::ALT_SEPARATOR)].join(File::PATH_SEPARATOR) + ENV["PATH"] = [orig_path, bin_dir.tr(File::SEPARATOR, File::ALT_SEPARATOR)].join(File::PATH_SEPARATOR) use_ui @ui do installer.check_that_user_bin_dir_is_in_path @@ -223,13 +223,13 @@ gem 'other', version assert_empty @ui.error ensure - ENV["PATH"] = orig_PATH + ENV["PATH"] = orig_path end def test_check_that_user_bin_dir_is_in_path_tilde pend "Tilde is PATH is not supported under MS Windows" if Gem.win_platform? - orig_PATH = ENV["PATH"] + orig_path = ENV["PATH"] ENV["PATH"] = [ENV["PATH"], "~/bin"].join(File::PATH_SEPARATOR) installer = setup_base_installer @@ -241,7 +241,7 @@ gem 'other', version assert_empty @ui.error ensure - ENV["PATH"] = orig_PATH unless Gem.win_platform? + ENV["PATH"] = orig_path unless Gem.win_platform? end def test_check_that_user_bin_dir_is_in_path_not_in_path @@ -2462,11 +2462,11 @@ gem 'other', version end def load_relative(value) - orig_LIBRUBY_RELATIVE = RbConfig::CONFIG["LIBRUBY_RELATIVE"] + orig_libruby_relative = RbConfig::CONFIG["LIBRUBY_RELATIVE"] RbConfig::CONFIG["LIBRUBY_RELATIVE"] = value yield ensure - RbConfig::CONFIG["LIBRUBY_RELATIVE"] = orig_LIBRUBY_RELATIVE + RbConfig::CONFIG["LIBRUBY_RELATIVE"] = orig_libruby_relative end end diff --git a/test/rubygems/test_gem_platform.rb b/test/rubygems/test_gem_platform.rb index 38bfc9bce4..4d1e0298ea 100644 --- a/test/rubygems/test_gem_platform.rb +++ b/test/rubygems/test_gem_platform.rb @@ -175,7 +175,7 @@ class TestGemPlatform < Gem::TestCase end def test_initialize_mswin32_vc6 - orig_RUBY_SO_NAME = RbConfig::CONFIG["RUBY_SO_NAME"] + orig_ruby_so_name = RbConfig::CONFIG["RUBY_SO_NAME"] RbConfig::CONFIG["RUBY_SO_NAME"] = "msvcrt-ruby18" expected = ["x86", "mswin32", nil] @@ -184,8 +184,8 @@ class TestGemPlatform < Gem::TestCase assert_equal expected, platform.to_a, "i386-mswin32 VC6" ensure - if orig_RUBY_SO_NAME - RbConfig::CONFIG["RUBY_SO_NAME"] = orig_RUBY_SO_NAME + if orig_ruby_so_name + RbConfig::CONFIG["RUBY_SO_NAME"] = orig_ruby_so_name else RbConfig::CONFIG.delete "RUBY_SO_NAME" end diff --git a/test/rubygems/test_gem_request.rb b/test/rubygems/test_gem_request.rb index e260cfda90..b75b25b37b 100644 --- a/test/rubygems/test_gem_request.rb +++ b/test/rubygems/test_gem_request.rb @@ -479,19 +479,19 @@ ERROR: Certificate is an invalid CA certificate def util_restore_version Object.send :remove_const, :RUBY_ENGINE - Object.send :const_set, :RUBY_ENGINE, @orig_RUBY_ENGINE + Object.send :const_set, :RUBY_ENGINE, @orig_ruby_engine Object.send :remove_const, :RUBY_PATCHLEVEL - Object.send :const_set, :RUBY_PATCHLEVEL, @orig_RUBY_PATCHLEVEL + Object.send :const_set, :RUBY_PATCHLEVEL, @orig_ruby_patchlevel Object.send :remove_const, :RUBY_REVISION - Object.send :const_set, :RUBY_REVISION, @orig_RUBY_REVISION + Object.send :const_set, :RUBY_REVISION, @orig_ruby_revision end def util_save_version - @orig_RUBY_ENGINE = RUBY_ENGINE - @orig_RUBY_PATCHLEVEL = RUBY_PATCHLEVEL - @orig_RUBY_REVISION = RUBY_REVISION + @orig_ruby_engine = RUBY_ENGINE + @orig_ruby_patchlevel = RUBY_PATCHLEVEL + @orig_ruby_revision = RUBY_REVISION end def util_stub_net_http(hash) diff --git a/test/rubygems/test_gem_resolver.rb b/test/rubygems/test_gem_resolver.rb index eed06b01de..ada0808bcb 100644 --- a/test/rubygems/test_gem_resolver.rb +++ b/test/rubygems/test_gem_resolver.rb @@ -779,29 +779,29 @@ class TestGemResolver < Gem::TestCase end def test_sorts_by_source_then_version - sourceA = Gem::Source.new "http://example.com/a" - sourceB = Gem::Source.new "http://example.com/b" - sourceC = Gem::Source.new "http://example.com/c" + source_a = Gem::Source.new "http://example.com/a" + source_b = Gem::Source.new "http://example.com/b" + source_c = Gem::Source.new "http://example.com/c" - spec_A_1 = util_spec "some-dep", "0.0.1" - spec_A_2 = util_spec "some-dep", "1.0.0" - spec_B_1 = util_spec "some-dep", "0.0.1" - spec_B_2 = util_spec "some-dep", "0.0.2" - spec_C_1 = util_spec "some-dep", "0.1.0" + spec_a_1 = util_spec "some-dep", "0.0.1" + spec_a_2 = util_spec "some-dep", "1.0.0" + spec_b_1 = util_spec "some-dep", "0.0.1" + spec_b_2 = util_spec "some-dep", "0.0.2" + spec_c_1 = util_spec "some-dep", "0.1.0" set = StaticSet.new [ - Gem::Resolver::SpecSpecification.new(nil, spec_B_1, sourceB), - Gem::Resolver::SpecSpecification.new(nil, spec_B_2, sourceB), - Gem::Resolver::SpecSpecification.new(nil, spec_C_1, sourceC), - Gem::Resolver::SpecSpecification.new(nil, spec_A_2, sourceA), - Gem::Resolver::SpecSpecification.new(nil, spec_A_1, sourceA), + Gem::Resolver::SpecSpecification.new(nil, spec_b_1, source_b), + Gem::Resolver::SpecSpecification.new(nil, spec_b_2, source_b), + Gem::Resolver::SpecSpecification.new(nil, spec_c_1, source_c), + Gem::Resolver::SpecSpecification.new(nil, spec_a_2, source_a), + Gem::Resolver::SpecSpecification.new(nil, spec_a_1, source_a), ] dependency = make_dep "some-dep", "> 0" resolver = Gem::Resolver.new [dependency], set - assert_resolves_to [spec_B_2], resolver + assert_resolves_to [spec_b_2], resolver end def test_select_local_platforms diff --git a/test/rubygems/test_gem_source.rb b/test/rubygems/test_gem_source.rb index 3cdc9c238b..0372c6253c 100644 --- a/test/rubygems/test_gem_source.rb +++ b/test/rubygems/test_gem_source.rb @@ -213,12 +213,12 @@ class TestGemSource < Gem::TestCase end def test_spaceship_order_is_preserved_when_uri_differs - sourceA = Gem::Source.new "http://example.com/a" - sourceB = Gem::Source.new "http://example.com/b" + source_a = Gem::Source.new "http://example.com/a" + source_b = Gem::Source.new "http://example.com/b" - assert_equal(0, sourceA.<=>(sourceA), "sourceA <=> sourceA") # rubocop:disable Lint/BinaryOperatorWithIdenticalOperands - assert_equal(1, sourceA.<=>(sourceB), "sourceA <=> sourceB") - assert_equal(1, sourceB.<=>(sourceA), "sourceB <=> sourceA") + assert_equal(0, source_a.<=>(source_a), "source_a <=> source_a") # rubocop:disable Lint/BinaryOperatorWithIdenticalOperands + assert_equal(1, source_a.<=>(source_b), "source_a <=> source_b") + assert_equal(1, source_b.<=>(source_a), "source_b <=> source_a") end def test_update_cache_eh |