aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test
diff options
context:
space:
mode:
authorJack Nagel2014-07-16 21:11:48 -0500
committerJack Nagel2014-07-16 21:11:48 -0500
commit596f3ba0a00b90d6a47ef5860b371f08fc8a72bd (patch)
treeaf5cadf4da79fcf247d947bd7197556877f13832 /Library/Homebrew/test
parenta554b5c9b74bd94470ddd812295efc6ec44fbdde (diff)
downloadbrew-596f3ba0a00b90d6a47ef5860b371f08fc8a72bd.tar.bz2
Raise ArgumentError when a symbol can't be mapped to a version
The fact that this is implemented as a hash lookup is an implementation detail, so don't let the KeyError bubble up.
Diffstat (limited to 'Library/Homebrew/test')
-rw-r--r--Library/Homebrew/test/test_version_subclasses.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/Library/Homebrew/test/test_version_subclasses.rb b/Library/Homebrew/test/test_version_subclasses.rb
index 1dbaae47a..9261a7251 100644
--- a/Library/Homebrew/test/test_version_subclasses.rb
+++ b/Library/Homebrew/test/test_version_subclasses.rb
@@ -39,4 +39,9 @@ class MacOSVersionTests < Homebrew::TestCase
assert_operator @v, :===, Version.new("10.7")
assert_operator @v, :<, Version.new("10.8")
end
+
+ def test_from_symbol
+ assert_equal @v, MacOS::Version.from_symbol(:lion)
+ assert_raises(ArgumentError) { MacOS::Version.from_symbol(:foo) }
+ end
end