test/test_rubype.rb in rubype-0.3.0 vs test/test_rubype.rb in rubype-0.3.1
- old
+ new
@@ -130,9 +130,24 @@
typesig :private_mth, Numeric => NilClass
RUBY_CODE
end
end
+ def test_for_readme
+ assert_raises(Rubype::ArgumentTypeError) do
+ eval <<-RUBY_CODE
+ class MyClass
+ def sum(x, y)
+ x.to_i + y
+ end
+ typesig :sum, [Numeric, Numeric] => Numeric
+ end
+
+ MyClass.new.sum(:has_no_to_i, 2)
+ RUBY_CODE
+ end
+ end
+
private
def assert_equal_to_s(str, val)
assert_equal str, val.to_s
end