diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-11-24 04:26:27 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-11-24 04:26:27 +0000 |
commit | eb13bcec58cfd2a65b0d6996af65865f357699ad (patch) | |
tree | 8c2d40ac47f3357db59466ae254fd8ca6c387d8c /test/ripper/test_parser_events.rb | |
parent | 9c86c513f0912af07c9addb57026bab385abea35 (diff) | |
download | ruby-eb13bcec58cfd2a65b0d6996af65865f357699ad.tar.gz |
parse.y: refactor list literals
* parse.y (words, symbols, qwords, qsymbols): unify empty list and
non-empty list.
* parse.y (parser_parse_string): always dispatch a word separator
at the beginning of list literals.
[ruby-core:83871] [Bug #14126]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ripper/test_parser_events.rb')
-rw-r--r-- | test/ripper/test_parser_events.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/ripper/test_parser_events.rb b/test/ripper/test_parser_events.rb index 86720b1446..2fca61e1d1 100644 --- a/test/ripper/test_parser_events.rb +++ b/test/ripper/test_parser_events.rb @@ -1017,6 +1017,10 @@ class TestRipper::ParserEvents < Test::Unit::TestCase tree = parse('%w[a]', :on_qwords_add) {thru_qwords_add = true} assert_equal true, thru_qwords_add assert_equal '[array([a])]', tree + thru_qwords_add = false + tree = parse('%w[ a ]', :on_qwords_add) {thru_qwords_add = true} + assert_equal true, thru_qwords_add + assert_equal '[array([a])]', tree end def test_qsymbols_add @@ -1024,6 +1028,10 @@ class TestRipper::ParserEvents < Test::Unit::TestCase tree = parse('%i[a]', :on_qsymbols_add) {thru_qsymbols_add = true} assert_equal true, thru_qsymbols_add assert_equal '[array([:a])]', tree + thru_qsymbols_add = false + tree = parse('%i[ a ]', :on_qsymbols_add) {thru_qsymbols_add = true} + assert_equal true, thru_qsymbols_add + assert_equal '[array([:a])]', tree end def test_symbols_add @@ -1031,6 +1039,10 @@ class TestRipper::ParserEvents < Test::Unit::TestCase tree = parse('%I[a]', :on_symbols_add) {thru_symbols_add = true} assert_equal true, thru_symbols_add assert_equal '[array([:a])]', tree + thru_symbols_add = false + tree = parse('%I[ a ]', :on_symbols_add) {thru_symbols_add = true} + assert_equal true, thru_symbols_add + assert_equal '[array([:a])]', tree end def test_qwords_new @@ -1383,6 +1395,10 @@ class TestRipper::ParserEvents < Test::Unit::TestCase tree = parse('%W[a]', :on_words_add) {thru_words_add = true} assert_equal true, thru_words_add assert_equal '[array([a])]', tree + thru_words_add = false + tree = parse('%W[ a ]', :on_words_add) {thru_words_add = true} + assert_equal true, thru_words_add + assert_equal '[array([a])]', tree end def test_words_new |