mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* io.c (rb_io_ungetc): raise an exception at unread stream to
avoid unspecified behavior. [ruby-dev:22330] * test/ruby/test_system.rb (test_syntax): glob relatively from __FILE__. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
44182056f6
commit
163a6e81b2
3 changed files with 15 additions and 10 deletions
|
@ -1,3 +1,11 @@
|
|||
Tue Dec 23 19:42:59 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* io.c (rb_io_ungetc): raise an exception at unread stream to
|
||||
avoid unspecified behavior. [ruby-dev:22330]
|
||||
|
||||
* test/ruby/test_system.rb (test_syntax): glob relatively from
|
||||
__FILE__.
|
||||
|
||||
Tue Dec 23 18:09:40 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* pack.c (pack_pack): remove unnecessary negative value check.
|
||||
|
|
3
io.c
3
io.c
|
@ -1314,8 +1314,9 @@ rb_io_ungetc(io, c)
|
|||
int cc = NUM2INT(c);
|
||||
|
||||
GetOpenFile(io, fptr);
|
||||
if (!(fptr->mode & FMODE_RBUF))
|
||||
rb_raise(rb_eIOError, "unread stream");
|
||||
rb_io_check_readable(fptr);
|
||||
flush_before_seek(fptr);
|
||||
|
||||
if (ungetc(cc, fptr->f) == EOF && cc != EOF)
|
||||
rb_sys_fail(fptr->path);
|
||||
|
|
|
@ -54,15 +54,11 @@ class TestSystem < Test::Unit::TestCase
|
|||
|
||||
File.unlink "script_tmp" or `/bin/rm -f "script_tmp"`
|
||||
File.unlink "script_tmp.bak" or `/bin/rm -f "script_tmp.bak"`
|
||||
|
||||
if (dir = File.dirname(File.dirname($0))) == '.'
|
||||
dir = ""
|
||||
else
|
||||
dir << "/"
|
||||
end
|
||||
|
||||
def test_syntax
|
||||
assert_nothing_raised(Exception) do
|
||||
for script in Dir["#{dir}{lib,sample,ext}/**/*.rb"]
|
||||
for script in Dir[File.expand_path("../../../{lib,sample,ext}/**/*.rb", __FILE__)]
|
||||
valid_syntax? IO::read(script), script
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue