1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[rubygems/rubygems] Specify explicit separator not to be affected by $;

https://github.com/rubygems/rubygems/commit/1cea3d4dce
This commit is contained in:
Nobuyoshi Nakada 2020-03-08 17:38:37 +09:00 committed by Hiroshi SHIBATA
parent 241950b1c5
commit 6e80cabb90
Notes: git 2020-05-08 14:14:16 +09:00
2 changed files with 22 additions and 1 deletions

View file

@ -77,7 +77,7 @@ class Gem::Command
when Array
@extra_args = value
when String
@extra_args = value.split
@extra_args = value.split(' ')
end
end

View file

@ -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