Revert "Remove unused branches from Options.coerce"

This reverts commit cee42c339e7632eab15111e2c4e6c121ace6f9e2.
This commit is contained in:
Mike McQuaid 2014-08-13 08:45:07 +01:00
parent a61c3615d2
commit 00d1bb8d12
2 changed files with 11 additions and 0 deletions

View File

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

View File

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