diff options
| author | Mike McQuaid | 2014-08-13 08:45:06 +0100 |
|---|---|---|
| committer | Mike McQuaid | 2014-08-13 08:45:06 +0100 |
| commit | a61c3615d28e717b273b4b81cc3b956662f63471 (patch) | |
| tree | e5fbb09697bd2fb4d28e2e3d35e6d8cc2d5fdb20 /Library/Homebrew/test | |
| parent | f93a9aafca2c8fa2f1a7e616d0953280f1ec3352 (diff) | |
| download | brew-a61c3615d28e717b273b4b81cc3b956662f63471.tar.bz2 | |
Revert "Replace Options.coerce with an alternate constructor"
This reverts commit 8d2ef974a3a87bf4207f71ccb8a7b4776e16a016.
Diffstat (limited to 'Library/Homebrew/test')
| -rw-r--r-- | Library/Homebrew/test/test_build_options.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/test/test_options.rb | 12 |
2 files changed, 10 insertions, 6 deletions
diff --git a/Library/Homebrew/test/test_build_options.rb b/Library/Homebrew/test/test_build_options.rb index 7d2c952d9..a0c52da81 100644 --- a/Library/Homebrew/test/test_build_options.rb +++ b/Library/Homebrew/test/test_build_options.rb @@ -4,8 +4,8 @@ require "options" class BuildOptionsTests < Homebrew::TestCase def setup - args = Options.create(%w(--with-foo --with-bar --without-qux)) - opts = Options.create(%w(--with-foo --with-bar --without-baz --without-qux)) + args = Options.coerce(%w(--with-foo --with-bar --without-qux)) + opts = Options.coerce(%w(--with-foo --with-bar --without-baz --without-qux)) @build = BuildOptions.new(args, opts) end diff --git a/Library/Homebrew/test/test_options.rb b/Library/Homebrew/test/test_options.rb index 264ef772a..250360a30 100644 --- a/Library/Homebrew/test/test_options.rb +++ b/Library/Homebrew/test/test_options.rb @@ -132,18 +132,22 @@ class OptionsTests < Homebrew::TestCase assert_equal [foo, bar, baz].sort, (@options | options).to_a.sort end - def test_create_with_array + def test_coerce_with_array array = %w{--foo --bar} option1 = Option.new("foo") option2 = Option.new("bar") - assert_equal [option1, option2].sort, Options.create(array).to_a.sort + assert_equal [option1, option2].sort, Options.coerce(array).to_a.sort end - def test_create_splits_multiple_switches_with_single_dash + def test_coerce_raises_for_inappropriate_types + assert_raises(TypeError) { Options.coerce(1) } + end + + def test_coerce_splits_multiple_switches_with_single_dash array = %w{-vd} verbose = Option.new("-v") debug = Option.new("-d") - assert_equal [verbose, debug].sort, Options.create(array).to_a.sort + assert_equal [verbose, debug].sort, Options.coerce(array).to_a.sort end def test_copies_do_not_share_underlying_collection |
