* ext/stringio/stringio.c (strio_read): adjust behavior at reading
beyond EOF to IO. [ruby-dev:22205] * test/ruby/ut_eof.rb (TestEOF::Seek): test behaviors at reading beyond EOF. * test/ruby/test_file.rb, * test/stringio/test_stringio.rb: include TestEOF::Seek test case. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d6ce2b7b2b
commit
6395c3b38d
23
ChangeLog
23
ChangeLog
@ -1,7 +1,18 @@
|
||||
Wed Dec 10 17:16:06 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* ext/stringio/stringio.c (strio_read): adjust behavior at reading
|
||||
beyond EOF to IO. [ruby-dev:22205]
|
||||
|
||||
* test/ruby/ut_eof.rb (TestEOF::Seek): test behaviors at reading
|
||||
beyond EOF.
|
||||
|
||||
* test/ruby/test_file.rb, * test/stringio/test_stringio.rb:
|
||||
include TestEOF::Seek test case.
|
||||
|
||||
Wed Dec 10 15:01:19 2003 Shugo Maeda <shugo@ruby-lang.org>
|
||||
|
||||
* test/monitor/test_monitor.rb (test_cond): use Queue#deq
|
||||
insteadof sleep.
|
||||
instead of sleep.
|
||||
|
||||
Wed Dec 10 14:45:39 2003 WATANABE Hirofumi <eban@ruby-lang.org>
|
||||
|
||||
@ -20,12 +31,12 @@ Wed Dec 10 12:53:05 2003 WATANABE Hirofumi <eban@ruby-lang.org>
|
||||
|
||||
Tue Dec 9 23:32:23 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
||||
|
||||
* ext/tk/lib/tk.rb, ext/tk/lib/tkcanvas.rb, ext/tk/lib/tkdialog.rb,
|
||||
ext/tk/lib/tkentry.rb, ext/tk/lib/tkscrollbox.rb, ext/tk/lib/tktext.rb,
|
||||
ext/tk/sample/tkalignbox.rb, ext/tk/sample/tkcombobox.rb,
|
||||
* ext/tk/lib/tk.rb, ext/tk/lib/tkcanvas.rb, ext/tk/lib/tkdialog.rb,
|
||||
ext/tk/lib/tkentry.rb, ext/tk/lib/tkscrollbox.rb, ext/tk/lib/tktext.rb,
|
||||
ext/tk/sample/tkalignbox.rb, ext/tk/sample/tkcombobox.rb,
|
||||
ext/tk/sample/tkmultilistbox.rb, ext/tk/sample/tkoptdb.rb, ext/tk/sample/tktextframe.rb,
|
||||
ext/tk/sample/demos-en/dialog1.rb, ext/tk/sample/demos-en/dialog2.rb,
|
||||
ext/tk/sample/demos-jp/dialog1.rb, ext/tk/sample/demos-jp/dialog2.rb:
|
||||
ext/tk/sample/demos-en/dialog1.rb, ext/tk/sample/demos-en/dialog2.rb,
|
||||
ext/tk/sample/demos-jp/dialog1.rb, ext/tk/sample/demos-jp/dialog2.rb:
|
||||
overrided instance methods, which are private methods on the super
|
||||
class, are changed to 'private'
|
||||
|
||||
|
@ -867,6 +867,7 @@ strio_read(argc, argv, self)
|
||||
}
|
||||
str = rb_str_substr(ptr->string, ptr->pos, len);
|
||||
if (NIL_P(str)) {
|
||||
if (!(ptr->flags & STRIO_EOF)) str = rb_str_new(0, 0);
|
||||
ptr->flags |= STRIO_EOF;
|
||||
}
|
||||
else {
|
||||
|
@ -41,4 +41,6 @@ class TestFile < Test::Unit::TestCase
|
||||
yield f
|
||||
end
|
||||
alias open_file_rw open_file
|
||||
|
||||
include TestEOF::Seek
|
||||
end
|
||||
|
@ -53,4 +53,31 @@ module TestEOF
|
||||
assert_equal(nil, f.read(1))
|
||||
}
|
||||
end
|
||||
|
||||
module Seek
|
||||
def open_file_seek(content, pos)
|
||||
open_file(content) do |f|
|
||||
f.seek(pos)
|
||||
yield f
|
||||
end
|
||||
end
|
||||
|
||||
def test_eof_0_seek
|
||||
open_file_seek("", 10) {|f|
|
||||
assert_equal("", f.read)
|
||||
assert_equal(nil, f.read)
|
||||
}
|
||||
end
|
||||
|
||||
def test_eof_1_seek
|
||||
open_file_seek("a", 10) {|f|
|
||||
assert_equal("", f.read)
|
||||
assert_equal(nil, f.read)
|
||||
}
|
||||
open_file_seek("a", 1) {|f|
|
||||
assert_equal("", f.read)
|
||||
assert_equal(nil, f.read)
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -12,4 +12,6 @@ class TestStringIO < Test::Unit::TestCase
|
||||
yield f
|
||||
end
|
||||
alias open_file_rw open_file
|
||||
|
||||
include TestEOF::Seek
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user