提交 36ff09d7 编写于 作者: A Akira Matsuda

Test try! with a block

上级 ce0f977a
......@@ -120,6 +120,10 @@ def test_nonexisting_method_with_arguments_bang
assert_raise(NoMethodError) { @string.try!(method, 'llo', 'y') }
end
def test_try_only_block_bang
assert_equal @string.reverse, @string.try! { |s| s.reverse }
end
def test_valid_method
assert_equal 5, @string.try(:size)
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册