mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
parse.y: chomp by -l
* parse.y (rb_parser_while_loop): should chomp but not chop by -l option. [ruby-core:78099] [Bug #12926] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57373 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
18a315df43
commit
af9a151f0b
2 changed files with 5 additions and 4 deletions
6
parse.y
6
parse.y
|
@ -10728,7 +10728,7 @@ rb_parser_append_print(VALUE vparser, NODE *node)
|
|||
}
|
||||
|
||||
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 *node, int chop, int split)
|
|||
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);
|
||||
|
|
|
@ -48,7 +48,7 @@ class TestRubyOptions < Test::Unit::TestCase
|
|||
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::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
def test_warning
|
||||
save_rubyopt = ENV['RUBYOPT']
|
||||
ENV['RUBYOPT'] = nil
|
||||
|
|
Loading…
Add table
Reference in a new issue