From f19e048d244c709e2990ddbb0f986e8b51357bd2 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Thu, 4 Jul 2019 15:43:33 +0900 Subject: Do not dispatch a nil token in ripper As a comment token includes the newline, so delayed newline token just follows it should not be dispatched. [Bug #11485] Co-Authored-By: Jeremy Evans --- test/ripper/test_parser_events.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test/ripper') diff --git a/test/ripper/test_parser_events.rb b/test/ripper/test_parser_events.rb index 37d72542a7..2c3b141904 100644 --- a/test/ripper/test_parser_events.rb +++ b/test/ripper/test_parser_events.rb @@ -751,6 +751,12 @@ class TestRipper::ParserEvents < Test::Unit::TestCase assert_equal true, thru_ifop end + def test_ignored_nl + ignored_nl = [] + parse("foo # comment\n...\n", :on_ignored_nl) {|_, a| ignored_nl << a} + assert_equal ["\n"], ignored_nl + end + def test_lambda thru_lambda = false parse('->{}', :on_lambda) {thru_lambda = true} -- cgit v1.2.3