에 예외를 잡을 수 없습니다 ". 당신이 개를 나사"나는 이런 식으로 뭔가가 루비
class Vehicle
def self.set_color(input)
if %w{blue red green}.include?(input)
input
else
raise "Bad color"
end
end
end
class Car < Vehicle
def make_car
begin
my_color = Vehicle.set_color("orange")
rescue
puts "you screwed the pooch"
end
end
end
class CarTest < Test::Unit::TestCase
def test_number_one
c = Car.new
c.make_car
end
end
을하지만 어떤 이유로, 내 테스트는 예외를 발생하고 그것을 잡기를 출력하는 대신 실행을 중지입니다 왜 이런 일이 일어나고 그것을 고치는 법입니까?
감사합니다.
을해야합니까? 그것은 나를 위해해야하는 것처럼 "당신이 멍청이를 망쳤다."라고 출력한다. – dbr