TypeError is appropriate here
This commit is contained in:
parent
666b48e391
commit
894a6c9776
@ -59,7 +59,7 @@ class DependencyCollector
|
|||||||
when Class
|
when Class
|
||||||
parse_class_spec(spec, tag)
|
parse_class_spec(spec, tag)
|
||||||
else
|
else
|
||||||
raise "Unsupported type #{spec.class} for #{spec}"
|
raise TypeError, "Unsupported type #{spec.class} for #{spec}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ class DependencyCollector
|
|||||||
if spec < Requirement
|
if spec < Requirement
|
||||||
spec.new(tag)
|
spec.new(tag)
|
||||||
else
|
else
|
||||||
raise "#{spec} is not a Requirement subclass"
|
raise TypeError, "#{spec} is not a Requirement subclass"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -110,4 +110,12 @@ class DependencyCollectorTests < Test::Unit::TestCase
|
|||||||
MacOS.stubs(:version).returns(MacOS::Version.new(10.7))
|
MacOS.stubs(:version).returns(MacOS::Version.new(10.7))
|
||||||
assert_equal X11Dependency::Proxy.new(:libpng), @d.build(:libpng)
|
assert_equal X11Dependency::Proxy.new(:libpng), @d.build(:libpng)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_raises_typeerror_for_unknown_classes
|
||||||
|
assert_raises(TypeError) { @d.add(Class.new) }
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_raises_typeerror_for_unknown_types
|
||||||
|
assert_raises(TypeError) { @d.add(Object.new) }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user