summaryrefslogtreecommitdiff
path: root/test/ripper/test_sexp.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-04 05:30:44 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-04 05:30:44 +0000
commitb17a16c279f6738070d1cb2de1f2139692850028 (patch)
tree83ff276fa7b48ca87a22e9c6c676ccd8ac2a99f8 /test/ripper/test_sexp.rb
parent8e03b79e0608a084537e360329fe3a4b0265e0c3 (diff)
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
Diffstat (limited to 'test/ripper/test_sexp.rb')
-rw-r--r--test/ripper/test_sexp.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ripper/test_sexp.rb b/test/ripper/test_sexp.rb
index d3afbb2..bbab398 100644
--- a/test/ripper/test_sexp.rb
+++ b/test/ripper/test_sexp.rb
@@ -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|