ruby-changes:48000
From: nobu <ko1@a...>
Date: Wed, 4 Oct 2017 14:30:49 +0900 (JST)
Subject: [ruby-changes:48000] nobu:r60114 (trunk): test_sexp.rb: test for fname
nobu 2017-10-04 14:30:44 +0900 (Wed, 04 Oct 2017) New Revision: 60114 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60114 Log: 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] Modified files: trunk/test/ripper/test_sexp.rb Index: test/ripper/test_sexp.rb =================================================================== --- test/ripper/test_sexp.rb (revision 60113) +++ test/ripper/test_sexp.rb (revision 60114) @@ -75,6 +75,18 @@ eot https://github.com/ruby/ruby/blob/trunk/test/ripper/test_sexp.rb#L75 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| -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/