aboutsummaryrefslogtreecommitdiffstats
path: root/test/ripper/test_parser_events.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-26 02:39:14 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-26 02:39:14 +0000
commitcc479b25ba715099ac721ad9d0b1b4237fa2b9f9 (patch)
treeaf9f6addc574d041d1105710ce2699b25fd293ca /test/ripper/test_parser_events.rb
parent6d8c13bc61c465ab400a12e0a44e9de52f117b7b (diff)
downloadruby-cc479b25ba715099ac721ad9d0b1b4237fa2b9f9.tar.gz
* parse.y (stmt): missing ripper rule. i.e., `a::B ||= c 1'.
http://twitter.com/#!/wannabe53/status/18797576396472321 http://twitter.com/#!/wannabe53/status/18798416150663168 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ripper/test_parser_events.rb')
-rw-r--r--test/ripper/test_parser_events.rb17
1 files changed, 13 insertions, 4 deletions
diff --git a/test/ripper/test_parser_events.rb b/test/ripper/test_parser_events.rb
index e269e271d4..7cf56546ca 100644
--- a/test/ripper/test_parser_events.rb
+++ b/test/ripper/test_parser_events.rb
@@ -20,7 +20,7 @@ class TestRipper::ParserEvents < Test::Unit::TestCase
def parse(str, nm = nil, &bl)
dp = DummyParser.new(str)
- dp.hook(nm, &bl) if nm
+ dp.hook(*nm, &bl) if nm
dp.parse.to_s
end
@@ -347,10 +347,10 @@ class TestRipper::ParserEvents < Test::Unit::TestCase
assert_equal true, thru_heredoc_beg
assert_match(/string_content\(\),heredoc\n/, tree, bug1921)
heredoc = nil
- parse("<<EOS\nheredoc1\nheredoc2\nEOS\n", :on_string_add) {|n, s| heredoc = s}
+ parse("<<EOS\nheredoc1\nheredoc2\nEOS\n", :on_string_add) {|e, n, s| heredoc = s}
assert_equal("heredoc1\nheredoc2\n", heredoc, bug1921)
heredoc = nil
- parse("<<-EOS\nheredoc1\nheredoc2\n\tEOS\n", :on_string_add) {|n, s| heredoc = s}
+ parse("<<-EOS\nheredoc1\nheredoc2\n\tEOS\n", :on_string_add) {|e, n, s| heredoc = s}
assert_equal("heredoc1\nheredoc2\n", heredoc, bug1921)
end
@@ -676,6 +676,15 @@ class TestRipper::ParserEvents < Test::Unit::TestCase
assert_equal true, thru_opassign
end
+ def test_opassign_error
+ thru_opassign = []
+ events = [:on_opassign, :on_assign_error]
+ parse('a::X ||= c 1', events) {|a,*b|
+ thru_opassign << a
+ }
+ assert_equal events, thru_opassign
+ end
+
def test_param_error
thru_param_error = false
parse('def foo(A) end', :on_param_error) {thru_param_error = true}
@@ -1104,7 +1113,7 @@ class TestRipper::ParserEvents < Test::Unit::TestCase
def test_unterminated_regexp
compile_error = false
- parse('/', :compile_error) {|msg| compile_error = msg}
+ parse('/', :compile_error) {|e, msg| compile_error = msg}
assert_equal("unterminated regexp meets end of file", compile_error)
end
end if ripper_test