summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-03-08 17:38:37 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2020-05-08 14:13:29 +0900
commit6e80cabb90cec19db24cf4e19fcd4e65cdf41e70 (patch)
tree378bdc703b8c81d5777cb8d39f88d3d82371a3ae
parent241950b1c546924c54ad9df3d67ba9c4f566c35b (diff)
[rubygems/rubygems] Specify explicit separator not to be affected by $;
https://github.com/rubygems/rubygems/commit/1cea3d4dce
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3092
-rw-r--r--lib/rubygems/command.rb2
-rw-r--r--test/rubygems/test_gem_command.rb21
2 files changed, 22 insertions, 1 deletions
diff --git a/lib/rubygems/command.rb b/lib/rubygems/command.rb
index 9b7b41d3a7..2fb3dab2fe 100644
--- a/lib/rubygems/command.rb
+++ b/lib/rubygems/command.rb
@@ -77,7 +77,7 @@ class Gem::Command
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 c3f057f2ff..44ec324ab9 100644
--- a/test/rubygems/test_gem_command.rb
+++ b/test/rubygems/test_gem_command.rb
@@ -57,6 +57,27 @@ class TestGemCommand < Gem::TestCase
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