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