diff options
author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2019-12-13 20:19:08 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2019-12-13 20:19:33 +0900 |
commit | 82cc2843a92b286cc13afd0860a4e111d4ea2a0b (patch) | |
tree | a517dedd40d35540930cea7732f5a36e76a549e8 /test/rubygems/test_gem_command.rb | |
parent | 26774351dc5f494253ba031e4bc453dc4dddb2cf (diff) | |
download | ruby-82cc2843a92b286cc13afd0860a4e111d4ea2a0b.tar.gz |
Prepare to release RubyGems 3.1.0 final version.
Diffstat (limited to 'test/rubygems/test_gem_command.rb')
-rw-r--r-- | test/rubygems/test_gem_command.rb | 47 |
1 files changed, 38 insertions, 9 deletions
diff --git a/test/rubygems/test_gem_command.rb b/test/rubygems/test_gem_command.rb index d51371301e..230baa5356 100644 --- a/test/rubygems/test_gem_command.rb +++ b/test/rubygems/test_gem_command.rb @@ -197,9 +197,9 @@ class TestGemCommand < Gem::TestCase assert_equal ['-h', 'command'], args end - def test_deprecate_option_long_name + def test_deprecate_option deprecate_msg = <<-EXPECTED -WARNING: The \"--test\" option has been deprecated and will be removed in Rubygems 3.1, its use is discouraged. +WARNING: The \"--test\" option has been deprecated and will be removed in Rubygems 3.1. EXPECTED testCommand = Class.new(Gem::Command) do @@ -210,7 +210,7 @@ WARNING: The \"--test\" option has been deprecated and will be removed in Rubyg options[:test] = true end - deprecate_option(long_name: '--test', version: '3.1') + deprecate_option('--test', version: '3.1') end def execute @@ -228,7 +228,7 @@ WARNING: The \"--test\" option has been deprecated and will be removed in Rubyg def test_deprecate_option_no_version deprecate_msg = <<-EXPECTED -WARNING: The \"--test\" option has been deprecated and will be removed in future versions of Rubygems, its use is discouraged. +WARNING: The \"--test\" option has been deprecated and will be removed in future versions of Rubygems. EXPECTED testCommand = Class.new(Gem::Command) do @@ -239,7 +239,7 @@ WARNING: The \"--test\" option has been deprecated and will be removed in futur options[:test] = true end - deprecate_option(long_name: '--test') + deprecate_option('--test') end def execute @@ -255,9 +255,9 @@ WARNING: The \"--test\" option has been deprecated and will be removed in futur end end - def test_deprecate_option_short_name + def test_deprecate_option_extra_message deprecate_msg = <<-EXPECTED -WARNING: The \"-t\" option has been deprecated and will be removed in Rubygems 3.5, its use is discouraged. +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 @@ -268,7 +268,7 @@ WARNING: The \"-t\" option has been deprecated and will be removed in Rubygems options[:test] = true end - deprecate_option(short_name: '-t', version: '3.5') + deprecate_option('--test', version: '3.1', extra_msg: 'Whether you set `--test` mode or not, this dummy app always runs in test mode.') end def execute @@ -279,7 +279,36 @@ WARNING: The \"-t\" option has been deprecated and will be removed in Rubygems cmd = testCommand.new use_ui @ui do - cmd.invoke("-t") + cmd.invoke("--test") + assert_equal deprecate_msg, @ui.error + end + end + + def test_deprecate_option_extra_message_and_no_version + deprecate_msg = <<-EXPECTED +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 + def initialize + super('test', 'Gem::Command instance for testing') + + add_option('-t', '--test', 'Test command') do |value, options| + options[:test] = true + end + + deprecate_option('--test', extra_msg: 'Whether you set `--test` mode or not, this dummy app always runs in test mode.') + end + + def execute + true + end + end + + cmd = testCommand.new + + use_ui @ui do + cmd.invoke("--test") assert_equal deprecate_msg, @ui.error end end |