diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-11-23 04:30:23 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-11-23 04:30:23 +0000 |
commit | dee6a910024e119b6064031487f87d927d960304 (patch) | |
tree | 607b3cc0e2c6c9049ea53a5d54c51fa61a1e4379 /test/ripper | |
parent | 717b7fd9c45d50a3fb24e744f61628bc2f5d4b75 (diff) |
ripper.y: fix word list events
* parse.y (parser_skip_words_sep): QWORDS_BEG should not include
the first separators in ripper.
* parse.y (parser_parse_string): WORDS_SEP should not include
the closing parentheses of a word list in ripper, should include
spaces at beginning of lines. [ruby-core:83864] [Bug #14126]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60883 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ripper')
-rw-r--r-- | test/ripper/test_scanner_events.rb | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/test/ripper/test_scanner_events.rb b/test/ripper/test_scanner_events.rb index 90fd599a31..b7c5a02322 100644 --- a/test/ripper/test_scanner_events.rb +++ b/test/ripper/test_scanner_events.rb @@ -637,8 +637,10 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase scan('words_beg', '%W()') assert_equal ['%W('], scan('words_beg', '%W(w w w)') - assert_equal ['%W( '], + assert_equal ['%W('], scan('words_beg', '%W( w w w )') + assert_equal ['%W('], + scan('words_beg', "%W(\nw)") end def test_qwords_beg @@ -648,8 +650,10 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase scan('qwords_beg', '%w()') assert_equal ['%w('], scan('qwords_beg', '%w(w w w)') - assert_equal ['%w( '], + assert_equal ['%w('], scan('qwords_beg', '%w( w w w )') + assert_equal ['%w('], + scan('qwords_beg', "%w(\nw)") end def test_qsymbols_beg @@ -659,8 +663,10 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase scan('qsymbols_beg', '%i()') assert_equal ['%i('], scan('qsymbols_beg', '%i(w w w)') - assert_equal ['%i( '], + assert_equal ['%i('], scan('qsymbols_beg', '%i( w w w )') + assert_equal ['%i('], + scan('qsymbols_beg', "%i(\nw)") end def test_symbols_beg @@ -670,22 +676,25 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase scan('symbols_beg', '%I()') assert_equal ['%I('], scan('symbols_beg', '%I(w w w)') - assert_equal ['%I( '], + assert_equal ['%I('], scan('symbols_beg', '%I( w w w )') + assert_equal ['%I('], + scan('symbols_beg', "%I(\nw)") end - # FIXME: Close paren must not present (`words_end' scanner event?). def test_words_sep assert_equal [], scan('words_sep', '') - assert_equal [')'], + assert_equal [], scan('words_sep', '%w()') - assert_equal [' ', ' ', ')'], + assert_equal [' ', ' '], scan('words_sep', '%w(w w w)') - assert_equal [' ', ' ', ' )'], + assert_equal [' ', ' ', ' ', ' '], scan('words_sep', '%w( w w w )') - assert_equal ["\n", ' ', ' )'], + assert_equal [' ', "\n", ' ', ' '], scan('words_sep', "%w( w\nw w )") + assert_equal ["\n\n", "\n ", ' ', ' '], + scan('words_sep', "%w(\n\nw\n w w )") end def test_heredoc_beg |