ruby-changes:61110
From: Nobuyoshi <ko1@a...>
Date: Fri, 8 May 2020 14:14:25 +0900 (JST)
Subject: [ruby-changes:61110] 6e80cabb90 (master): [rubygems/rubygems] Specify explicit separator not to be affected by $;
https://git.ruby-lang.org/ruby.git/commit/?id=6e80cabb90 From 6e80cabb90cec19db24cf4e19fcd4e65cdf41e70 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Sun, 8 Mar 2020 17:38:37 +0900 Subject: [rubygems/rubygems] Specify explicit separator not to be affected by $; https://github.com/rubygems/rubygems/commit/1cea3d4dce diff --git a/lib/rubygems/command.rb b/lib/rubygems/command.rb index 9b7b41d..2fb3dab 100644 --- a/lib/rubygems/command.rb +++ b/lib/rubygems/command.rb @@ -77,7 +77,7 @@ class Gem::Command https://github.com/ruby/ruby/blob/trunk/lib/rubygems/command.rb#L77 when Array @extra_args = value when String - @extra_args = value.split + @extra_args = value.split(' ') end end diff --git a/test/rubygems/test_gem_command.rb b/test/rubygems/test_gem_command.rb index c3f057f..44ec324 100644 --- a/test/rubygems/test_gem_command.rb +++ b/test/rubygems/test_gem_command.rb @@ -57,6 +57,27 @@ class TestGemCommand < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_command.rb#L57 assert_equal [], h end + def test_self_extra_args + verbose, $VERBOSE, separator = $VERBOSE, nil, $; + extra_args = Gem::Command.extra_args + + Gem::Command.extra_args = %w[--all] + assert_equal %w[--all], Gem::Command.extra_args + + Gem::Command.extra_args = "--file --help" + assert_equal %w[--file --help], Gem::Command.extra_args + + $; = "=" + + Gem::Command.extra_args = "--awesome=true --verbose" + assert_equal %w[--awesome=true --verbose], Gem::Command.extra_args + + ensure + Gem::Command.extra_args = extra_args + $; = separator + $VERBOSE = verbose + end + def test_basic_accessors assert_equal "doit", @cmd.command assert_equal "gem doit", @cmd.program_name -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/