From 91bd6e711db3418baa287e936d4b0fac99927711 Mon Sep 17 00:00:00 2001 From: tenderlove Date: Tue, 24 Jul 2012 18:10:35 +0000 Subject: * parse.y: added symbols and qsymbols productions for %i and %I support. %i{ .. } returns a list of symbols without interpolation, %I{ .. } returns a list of symbols with interpolation. Thanks to Josh Susser for inspiration of this feature. [Feature #4985] * ext/ripper/eventids2.c: added ripper events for %i and %I. * test/ripper/test_parser_events.rb: ripper tests * test/ripper/test_scanner_events.rb: ditto * test/ruby/test_array.rb: test for %i and %I behavior git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36524 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ripper/test_scanner_events.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'test/ripper/test_scanner_events.rb') diff --git a/test/ripper/test_scanner_events.rb b/test/ripper/test_scanner_events.rb index 5b58dd8289..bcbbf0192c 100644 --- a/test/ripper/test_scanner_events.rb +++ b/test/ripper/test_scanner_events.rb @@ -608,6 +608,28 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase scan('qwords_beg', '%w( w w w )') end + def test_qsymbols_beg + assert_equal [], + scan('qsymbols_beg', '') + assert_equal ['%i('], + scan('qsymbols_beg', '%i()') + assert_equal ['%i('], + scan('qsymbols_beg', '%i(w w w)') + assert_equal ['%i( '], + scan('qsymbols_beg', '%i( w w w )') + end + + def test_symbols_beg + assert_equal [], + scan('symbols_beg', '') + assert_equal ['%I('], + scan('symbols_beg', '%I()') + assert_equal ['%I('], + scan('symbols_beg', '%I(w w w)') + assert_equal ['%I( '], + scan('symbols_beg', '%I( w w w )') + end + # FIXME: Close paren must not present (`words_end' scanner event?). def test_words_sep assert_equal [], -- cgit v1.2.1