[前][次][番号順一覧][スレッド一覧]

ruby-changes:47850

From: nobu <ko1@a...>
Date: Wed, 20 Sep 2017 09:53:54 +0900 (JST)
Subject: [ruby-changes:47850] nobu:r59970 (trunk): ruby.c: paragraph mode by -00

nobu	2017-09-20 09:53:47 +0900 (Wed, 20 Sep 2017)

  New Revision: 59970

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59970

  Log:
    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]

  Modified files:
    trunk/ruby.c
    trunk/test/ruby/test_rubyoptions.rb
Index: test/ruby/test_rubyoptions.rb
===================================================================
--- test/ruby/test_rubyoptions.rb	(revision 59969)
+++ test/ruby/test_rubyoptions.rb	(revision 59970)
@@ -187,6 +187,8 @@ class TestRubyOptions < Test::Unit::Test https://github.com/ruby/ruby/blob/trunk/test/ruby/test_rubyoptions.rb#L187
     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
Index: ruby.c
===================================================================
--- ruby.c	(revision 59969)
+++ ruby.c	(revision 59970)
@@ -1162,7 +1162,7 @@ proc_options(long argc, char **argv, rub https://github.com/ruby/ruby/blob/trunk/ruby.c#L1162
 		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;

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]