From 79e0a19353a6015cb653a9cfc078203bf296da0b Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 20 Sep 2017 00:53:47 +0000 Subject: [PATCH] ruby.c: paragraph mode by -00 * ruby.c (proc_options): set to paragraph mode, if -00 is given, as well as perl and -R0 option in 0.49. [ruby-core:81987] [Bug #13736] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ruby.c | 2 +- test/ruby/test_rubyoptions.rb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ruby.c b/ruby.c index f2f3c86e09..3a7b35f010 100644 --- a/ruby.c +++ b/ruby.c @@ -1162,7 +1162,7 @@ proc_options(long argc, char **argv, ruby_cmdline_options_t *opt, int envopt) if (v > 0377) rb_rs = Qnil; else if (v == 0 && numlen >= 2) { - rb_rs = rb_str_new2("\n\n"); + rb_rs = rb_str_new2(""); } else { c = v & 0xff; diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb index 6e83d37151..6b598162d8 100644 --- a/test/ruby/test_rubyoptions.rb +++ b/test/ruby/test_rubyoptions.rb @@ -187,6 +187,8 @@ class TestRubyOptions < Test::Unit::TestCase assert_in_out_err(%w(-0e) + ["print gets"], "foo\nbar\0baz", %W(foo bar\0), []) assert_in_out_err(%w(-00 -e) + ["p gets, gets"], "foo\nbar\n\nbaz\nzot\n\n\n", %w("foo\nbar\n\n" "baz\nzot\n\n"), []) + + assert_in_out_err(%w(-00 -e) + ["p gets, gets"], "foo\nbar\n\n\n\nbaz\n", %w("foo\nbar\n\n" "baz\n"), []) end def test_autosplit