Revert "Remove unused branches from Options.coerce"
This reverts commit cee42c339e7632eab15111e2c4e6c121ace6f9e2.
This commit is contained in:
parent
a61c3615d2
commit
00d1bb8d12
@ -116,6 +116,8 @@ class Options
|
||||
|
||||
def self.coerce(arg)
|
||||
case arg
|
||||
when self then arg
|
||||
when Option then new << arg
|
||||
when Array
|
||||
opts = new
|
||||
arg.each do |a|
|
||||
|
||||
@ -132,6 +132,15 @@ class OptionsTests < Homebrew::TestCase
|
||||
assert_equal [foo, bar, baz].sort, (@options | options).to_a.sort
|
||||
end
|
||||
|
||||
def test_coerce_with_options
|
||||
assert_same @options, Options.coerce(@options)
|
||||
end
|
||||
|
||||
def test_coerce_with_option
|
||||
option = Option.new("foo")
|
||||
assert_equal option, Options.coerce(option).to_a.first
|
||||
end
|
||||
|
||||
def test_coerce_with_array
|
||||
array = %w{--foo --bar}
|
||||
option1 = Option.new("foo")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user