diff options
| author | Jack Nagel | 2014-08-07 00:48:13 -0500 |
|---|---|---|
| committer | Jack Nagel | 2014-08-07 00:48:13 -0500 |
| commit | acc1c35f35fb86957d56e19988fd4aeabae57b9e (patch) | |
| tree | 5ff687100ad4f276f896e49f87f7c2fd5adf7b6e /Library | |
| parent | 20452f3edc22ede05814a7355d65c9ef4547b3b0 (diff) | |
| download | brew-acc1c35f35fb86957d56e19988fd4aeabae57b9e.tar.bz2 | |
Raise ArgumentError for argument errors
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/software_spec.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/test/test_software_spec.rb | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/Library/Homebrew/software_spec.rb b/Library/Homebrew/software_spec.rb index 88370e0fa..fe0277adb 100644 --- a/Library/Homebrew/software_spec.rb +++ b/Library/Homebrew/software_spec.rb @@ -78,8 +78,8 @@ class SoftwareSpec def option name, description=nil name = 'c++11' if name == :cxx11 name = name.to_s if Symbol === name - raise "Option name is required." if name.empty? - raise "Options should not start with dashes." if name[0, 1] == "-" + raise ArgumentError, "option name is required" if name.empty? + raise ArgumentError, "options should not start with dashes" if name.start_with?("-") build.add(name, description) end diff --git a/Library/Homebrew/test/test_software_spec.rb b/Library/Homebrew/test/test_software_spec.rb index db2242022..702d2c581 100644 --- a/Library/Homebrew/test/test_software_spec.rb +++ b/Library/Homebrew/test/test_software_spec.rb @@ -48,11 +48,11 @@ class SoftwareSpecTests < Homebrew::TestCase end def test_option_raises_when_begins_with_dashes - assert_raises(RuntimeError) { @spec.option('--foo') } + assert_raises(ArgumentError) { @spec.option("--foo") } end def test_option_raises_when_name_empty - assert_raises(RuntimeError) { @spec.option('') } + assert_raises(ArgumentError) { @spec.option("") } end def test_option_accepts_symbols |
