ruby-changes:45382
From: nobu <ko1@a...>
Date: Sun, 29 Jan 2017 21:53:27 +0900 (JST)
Subject: [ruby-changes:45382] nobu:r57455 (trunk): test for top level statement
nobu 2017-01-29 21:53:23 +0900 (Sun, 29 Jan 2017) New Revision: 57455 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57455 Log: test for top level statement Modified files: trunk/test/irb/test_ruby-lex.rb Index: test/irb/test_ruby-lex.rb =================================================================== --- test/irb/test_ruby-lex.rb (revision 57454) +++ test/irb/test_ruby-lex.rb (revision 57455) @@ -20,6 +20,21 @@ module TestIRB https://github.com/ruby/ruby/blob/trunk/test/irb/test_ruby-lex.rb#L20 assert_equal([["#\n", 1]], top_level_statement("#\n")) end + def test_top_level_statement + result = top_level_statement("#{<<-"begin;"}#{<<~"end;"}") + begin; + begin + end + begin + end + end; + assert_equal([ + ["begin\n""end\n", 1], + ["begin\n""end\n", 3], + ], + result) + end + def top_level_statement(lines) input = InputLines.new(lines, "r") scanned = [] -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/