ruby-changes:45300
From: nobu <ko1@a...>
Date: Thu, 19 Jan 2017 16:18:27 +0900 (JST)
Subject: [ruby-changes:45300] nobu:r57373 (trunk): parse.y: chomp by -l
nobu 2017-01-19 16:18:23 +0900 (Thu, 19 Jan 2017) New Revision: 57373 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57373 Log: parse.y: chomp by -l * parse.y (rb_parser_while_loop): should chomp but not chop by -l option. [ruby-core:78099] [Bug #12926] Modified files: trunk/parse.y trunk/test/ruby/test_rubyoptions.rb Index: parse.y =================================================================== --- parse.y (revision 57372) +++ parse.y (revision 57373) @@ -10728,7 +10728,7 @@ rb_parser_append_print(VALUE vparser, NO https://github.com/ruby/ruby/blob/trunk/parse.y#L10728 } NODE * -rb_parser_while_loop(VALUE vparser, NODE *node, int chop, int split) +rb_parser_while_loop(VALUE vparser, NODE *node, int chomp, int split) { NODE *prelude = 0; NODE *scope = node; @@ -10750,9 +10750,9 @@ rb_parser_while_loop(VALUE vparser, NODE https://github.com/ruby/ruby/blob/trunk/parse.y#L10750 rb_intern("split"), 0)), node); } - if (chop) { + if (chomp) { node = block_append(NEW_CALL(NEW_GVAR(idLASTLINE), - rb_intern("chop!"), 0), node); + rb_intern("chomp!"), 0), node); } node = NEW_OPT_N(node); Index: test/ruby/test_rubyoptions.rb =================================================================== --- test/ruby/test_rubyoptions.rb (revision 57372) +++ test/ruby/test_rubyoptions.rb (revision 57373) @@ -48,7 +48,7 @@ class TestRubyOptions < Test::Unit::Test https://github.com/ruby/ruby/blob/trunk/test/ruby/test_rubyoptions.rb#L48 end assert_in_out_err(%w(-p -l -a -e) + ['p [$-p, $-l, $-a]'], - "foo\nbar\nbaz\n") do |r, e| + "foo\nbar\nbaz") do |r, e| assert_equal( [ '[true, true, true]', 'foo', '[true, true, true]', 'bar', @@ -57,6 +57,7 @@ class TestRubyOptions < Test::Unit::Test https://github.com/ruby/ruby/blob/trunk/test/ruby/test_rubyoptions.rb#L57 end end + def test_warning save_rubyopt = ENV['RUBYOPT'] ENV['RUBYOPT'] = nil -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/