aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test/test_exceptions.rb
diff options
context:
space:
mode:
authorMartin Afanasjew2016-04-16 22:08:04 +0200
committerMartin Afanasjew2016-04-17 21:16:01 +0200
commit144d86f73315f59d65234ace69880bb9d3a90acb (patch)
tree6698a03cf68cd92255f820d206c8acc940637c57 /Library/Homebrew/test/test_exceptions.rb
parent94a627d7aafb59107a0d94766585205a416114f0 (diff)
downloadbrew-144d86f73315f59d65234ace69880bb9d3a90acb.tar.bz2
tests: test FormulaClassUnavailableError
Closes #101. Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
Diffstat (limited to 'Library/Homebrew/test/test_exceptions.rb')
-rw-r--r--Library/Homebrew/test/test_exceptions.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/Library/Homebrew/test/test_exceptions.rb b/Library/Homebrew/test/test_exceptions.rb
index e49201736..88744a255 100644
--- a/Library/Homebrew/test/test_exceptions.rb
+++ b/Library/Homebrew/test/test_exceptions.rb
@@ -37,6 +37,25 @@ class ExceptionsTest < Homebrew::TestCase
TapFormulaUnavailableError.new(t, "foo").to_s
end
+ def test_formula_class_unavailable_error
+ mod = Module.new
+ mod.module_eval <<-EOS.undent
+ class Bar < Requirement; end
+ class Baz < Formula; end
+ EOS
+
+ assert_match "Expected to find class Foo, but found no classes.",
+ FormulaClassUnavailableError.new("foo", "foo.rb", "Foo", []).to_s
+
+ list = [mod.const_get(:Bar)]
+ assert_match "Expected to find class Foo, but only found: Bar (not derived from Formula!).",
+ FormulaClassUnavailableError.new("foo", "foo.rb", "Foo", list).to_s
+
+ list = [mod.const_get(:Baz)]
+ assert_match "Expected to find class Foo, but only found: Baz.",
+ FormulaClassUnavailableError.new("foo", "foo.rb", "Foo", list).to_s
+ end
+
def test_tap_unavailable_error
assert_equal "No available tap foo.\n", TapUnavailableError.new("foo").to_s
end