ruby-changes:5597
From: mame <ko1@a...>
Date: Thu, 12 Jun 2008 03:33:42 +0900 (JST)
Subject: [ruby-changes:5597] Ruby:r17103 (ruby_1_8): * ext/stringio/stringio.c (strio_init): rewind when reopened.
mame 2008-06-12 03:30:10 +0900 (Thu, 12 Jun 2008) New Revision: 17103 Modified files: branches/ruby_1_8/ChangeLog branches/ruby_1_8/ext/stringio/stringio.c branches/ruby_1_8/test/stringio/test_stringio.rb branches/ruby_1_8/version.h Log: * ext/stringio/stringio.c (strio_init): rewind when reopened. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/test/stringio/test_stringio.rb?r1=17103&r2=17102&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ChangeLog?r1=17103&r2=17102&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ext/stringio/stringio.c?r1=17103&r2=17102&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/version.h?r1=17103&r2=17102&diff_format=u Index: ruby_1_8/ext/stringio/stringio.c =================================================================== --- ruby_1_8/ext/stringio/stringio.c (revision 17102) +++ ruby_1_8/ext/stringio/stringio.c (revision 17103) @@ -269,6 +269,8 @@ break; } ptr->string = string; + ptr->pos = 0; + ptr->lineno = 0; } static VALUE Index: ruby_1_8/ChangeLog =================================================================== --- ruby_1_8/ChangeLog (revision 17102) +++ ruby_1_8/ChangeLog (revision 17103) @@ -1,3 +1,7 @@ +Thu Jun 12 03:20:59 2008 Yusuke Endoh <mame@t...> + + * ext/stringio/stringio.c (strio_init): rewind when reopened. + Thu Jun 12 00:56:20 2008 Nobuyoshi Nakada <nobu@r...> * ext/tk: check proper conditions. [ruby-dev:35047] Index: ruby_1_8/version.h =================================================================== --- ruby_1_8/version.h (revision 17102) +++ ruby_1_8/version.h (revision 17103) @@ -1,7 +1,7 @@ #define RUBY_VERSION "1.8.7" -#define RUBY_RELEASE_DATE "2008-06-10" +#define RUBY_RELEASE_DATE "2008-06-12" #define RUBY_VERSION_CODE 187 -#define RUBY_RELEASE_CODE 20080610 +#define RUBY_RELEASE_CODE 20080612 #define RUBY_PATCHLEVEL 5000 #define RUBY_VERSION_MAJOR 1 @@ -9,7 +9,7 @@ #define RUBY_VERSION_TEENY 7 #define RUBY_RELEASE_YEAR 2008 #define RUBY_RELEASE_MONTH 6 -#define RUBY_RELEASE_DAY 10 +#define RUBY_RELEASE_DAY 12 #ifdef RUBY_EXTERN RUBY_EXTERN const char ruby_version[]; Index: ruby_1_8/test/stringio/test_stringio.rb =================================================================== --- ruby_1_8/test/stringio/test_stringio.rb (revision 17102) +++ ruby_1_8/test/stringio/test_stringio.rb (revision 17103) @@ -40,4 +40,17 @@ end assert_equal("hacker\nother ruby\n", stringio.string) end + + def test_reopen + f = StringIO.new("foo\nbar\nbaz\n") + assert_equal("foo\n", f.gets) + f.reopen("qux\nquux\nquuux\n") + assert_equal("qux\n", f.gets) + + f2 = StringIO.new("") + f2.reopen(f) + assert_equal("quux\n", f2.gets) + ensure + f.close unless f.closed? + end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/