[ripper] added endless method definition event tests

This commit is contained in:
Nobuyoshi Nakada 2020-06-25 01:13:46 +09:00
Родитель 5dfe95d10e
Коммит 419b0596a2
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 7CD2805BFA3770C6
1 изменённых файлов: 10 добавлений и 0 удалений

Просмотреть файл

@ -652,6 +652,11 @@ class TestRipper::ParserEvents < Test::Unit::TestCase
} }
assert_equal true, thru_def assert_equal true, thru_def
assert_equal '[def(foo,[],bodystmt([void()]))]', parse('def foo ;end') assert_equal '[def(foo,[],bodystmt([void()]))]', parse('def foo ;end')
thru_def = false
tree = parse('def foo() = 42', :on_def) {thru_def = true}
assert_equal true, thru_def
assert_equal '[def(foo,[],42)]', tree
end end
def test_defined def test_defined
@ -669,6 +674,11 @@ class TestRipper::ParserEvents < Test::Unit::TestCase
thru_parse_error = false thru_parse_error = false
tree = parse('def foo&.bar; end', :on_parse_error) {thru_parse_error = true} tree = parse('def foo&.bar; end', :on_parse_error) {thru_parse_error = true}
assert_equal(true, thru_parse_error) assert_equal(true, thru_parse_error)
thru_defs = false
tree = parse('def foo.bar() = 42', :on_defs) {thru_defs = true}
assert_equal true, thru_defs
assert_equal '[defs(vcall(foo),.,bar,[],42)]', tree
end end
def test_do_block def test_do_block