summaryrefslogtreecommitdiff
path: root/test/ripper/test_sexp.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-05 01:53:22 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-05 01:53:22 +0000
commit80855409ced7d4ace932870dc515af54f64ceaa5 (patch)
tree6f30424a14fc6d481ad7407a04eaa5854cd4da25 /test/ripper/test_sexp.rb
parentd002f23024ed31c9b16dfa6f254b90761516c4dc (diff)
parse.y: fix KWD2EID
* parse.y (KWD2EID): should respect the previous callback result for keywords. [ruby-core:83106] [Bug #13971] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60120 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ripper/test_sexp.rb')
-rw-r--r--test/ripper/test_sexp.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ripper/test_sexp.rb b/test/ripper/test_sexp.rb
index bbab398..253b198 100644
--- a/test/ripper/test_sexp.rb
+++ b/test/ripper/test_sexp.rb
@@ -87,6 +87,15 @@ eot
assert_equal("<<", fname)
end
+ def test_defs_fname
+ sexp = Ripper.sexp("def self.t; end")
+ _, recv, _, (type, fname) = search_sexp(:defs, sexp)
+ assert_equal(:var_ref, recv[0], recv)
+ assert_equal([:@kw, "self", [1, 4]], recv[1], recv)
+ assert_equal(:@ident, type)
+ assert_equal("t", fname)
+ end
+
def search_sexp(sym, sexp)
return sexp if !sexp or sexp[0] == sym
sexp.find do |e|