mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
merge revision(s) 17103:
* ext/stringio/stringio.c (strio_init): rewind when reopened. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@26171 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
fe8e105823
commit
cea49f7ca6
4 changed files with 20 additions and 1 deletions
|
|
@ -1,3 +1,7 @@
|
|||
Thu Dec 24 17:50:35 2009 Yusuke Endoh <mame@tsg.ne.jp>
|
||||
|
||||
* ext/stringio/stringio.c (strio_init): rewind when reopened.
|
||||
|
||||
Thu Dec 24 17:06:13 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* gc.c (run_final): runs finalizers with the object terminated.
|
||||
|
|
|
|||
|
|
@ -269,6 +269,8 @@ strio_init(argc, argv, ptr)
|
|||
break;
|
||||
}
|
||||
ptr->string = string;
|
||||
ptr->pos = 0;
|
||||
ptr->lineno = 0;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
|
|
|||
|
|
@ -40,4 +40,17 @@ class TestStringIO < Test::Unit::TestCase
|
|||
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
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#define RUBY_RELEASE_DATE "2009-12-24"
|
||||
#define RUBY_VERSION_CODE 187
|
||||
#define RUBY_RELEASE_CODE 20091224
|
||||
#define RUBY_PATCHLEVEL 245
|
||||
#define RUBY_PATCHLEVEL 246
|
||||
|
||||
#define RUBY_VERSION_MAJOR 1
|
||||
#define RUBY_VERSION_MINOR 8
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue