summaryrefslogtreecommitdiff
path: root/test/ripper/dummyparser.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-24 04:26:23 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-24 04:26:23 +0000
commit9c86c513f0912af07c9addb57026bab385abea35 (patch)
tree7a7527778f1f368d21e4ab89168d00df0056885c /test/ripper/dummyparser.rb
parent4046ca57967b016fd82f3f065aae3732c15c301e (diff)
test_parser_events.rb: results of list literals
* test/ripper/test_parser_events.rb (test_qwords_add), (test_qsymbols_add, test_symbols_add, test_words_add): more assertions for results of list literals. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60891 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ripper/dummyparser.rb')
-rw-r--r--test/ripper/dummyparser.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/ripper/dummyparser.rb b/test/ripper/dummyparser.rb
index 4261ab5..ca36985 100644
--- a/test/ripper/dummyparser.rb
+++ b/test/ripper/dummyparser.rb
@@ -24,6 +24,16 @@ class Node
end
list
end
+
+ class Sym < self
+ def initialize(name)
+ @name = name
+ end
+
+ def to_s
+ ":#{@name}"
+ end
+ end
end
class NodeList
@@ -218,6 +228,22 @@ class DummyParser < Ripper
words.push word
end
+ def on_symbols_new
+ NodeList.new
+ end
+
+ def on_symbols_add(symbols, symbol)
+ symbols.push Node::Sym.new(symbol)
+ end
+
+ def on_qsymbols_new
+ NodeList.new
+ end
+
+ def on_qsymbols_add(symbols, symbol)
+ symbols.push Node::Sym.new(symbol)
+ end
+
def on_mlhs_new
NodeList.new
end