зеркало из https://github.com/github/ruby.git
test_sexp.rb: test for fname
* test/ripper/test_sexp.rb (test_def_fname): test for fname in def statement. [ruby-core:83089] [Bug #13967] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60114 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
8e03b79e06
Коммит
b17a16c279
|
@ -75,6 +75,18 @@ eot
|
|||
assert_equal("z", z[1])
|
||||
end
|
||||
|
||||
def test_def_fname
|
||||
sexp = Ripper.sexp("def t; end")
|
||||
_, (type, fname,) = search_sexp(:def, sexp)
|
||||
assert_equal(:@ident, type)
|
||||
assert_equal("t", fname)
|
||||
|
||||
sexp = Ripper.sexp("def <<; end")
|
||||
_, (type, fname,) = search_sexp(:def, sexp)
|
||||
assert_equal(:@op, type)
|
||||
assert_equal("<<", fname)
|
||||
end
|
||||
|
||||
def search_sexp(sym, sexp)
|
||||
return sexp if !sexp or sexp[0] == sym
|
||||
sexp.find do |e|
|
||||
|
|
Загрузка…
Ссылка в новой задаче