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
10
ChangeLog
10
ChangeLog
|
@ -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>
|
Tue Dec 23 18:09:40 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* pack.c (pack_pack): remove unnecessary negative value check.
|
* pack.c (pack_pack): remove unnecessary negative value check.
|
||||||
|
@ -27,7 +35,7 @@ Tue Dec 23 14:13:51 2003 akira yamada <akira@ruby-lang.org>
|
||||||
|
|
||||||
* test/uri/test_generic.rb (TestGeneric::test_set_component):
|
* test/uri/test_generic.rb (TestGeneric::test_set_component):
|
||||||
added tets.
|
added tets.
|
||||||
|
|
||||||
Tue Dec 23 11:08:34 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
|
Tue Dec 23 11:08:34 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
|
||||||
|
|
||||||
* test/xsd/test_noencoding.rb: rescue Errno::EINVAL and do not test.
|
* test/xsd/test_noencoding.rb: rescue Errno::EINVAL and do not test.
|
||||||
|
|
5
io.c
5
io.c
|
@ -1314,8 +1314,9 @@ rb_io_ungetc(io, c)
|
||||||
int cc = NUM2INT(c);
|
int cc = NUM2INT(c);
|
||||||
|
|
||||||
GetOpenFile(io, fptr);
|
GetOpenFile(io, fptr);
|
||||||
|
if (!(fptr->mode & FMODE_RBUF))
|
||||||
|
rb_raise(rb_eIOError, "unread stream");
|
||||||
rb_io_check_readable(fptr);
|
rb_io_check_readable(fptr);
|
||||||
flush_before_seek(fptr);
|
|
||||||
|
|
||||||
if (ungetc(cc, fptr->f) == EOF && cc != EOF)
|
if (ungetc(cc, fptr->f) == EOF && cc != EOF)
|
||||||
rb_sys_fail(fptr->path);
|
rb_sys_fail(fptr->path);
|
||||||
|
@ -3456,7 +3457,7 @@ rb_io_ctl(io, req, arg, io_p)
|
||||||
rb_raise(rb_eArgError, "return value overflowed string");
|
rb_raise(rb_eArgError, "return value overflowed string");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fptr->f2 && fileno(fptr->f) != fileno(fptr->f2)) {
|
if (fptr->f2 && fileno(fptr->f) != fileno(fptr->f2)) {
|
||||||
/* call on f2 too; ignore result */
|
/* call on f2 too; ignore result */
|
||||||
io_cntl(fileno(fptr->f2), cmd, narg, io_p);
|
io_cntl(fileno(fptr->f2), cmd, narg, io_p);
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,15 +54,11 @@ class TestSystem < Test::Unit::TestCase
|
||||||
|
|
||||||
File.unlink "script_tmp" or `/bin/rm -f "script_tmp"`
|
File.unlink "script_tmp" or `/bin/rm -f "script_tmp"`
|
||||||
File.unlink "script_tmp.bak" or `/bin/rm -f "script_tmp.bak"`
|
File.unlink "script_tmp.bak" or `/bin/rm -f "script_tmp.bak"`
|
||||||
|
end
|
||||||
|
|
||||||
if (dir = File.dirname(File.dirname($0))) == '.'
|
def test_syntax
|
||||||
dir = ""
|
|
||||||
else
|
|
||||||
dir << "/"
|
|
||||||
end
|
|
||||||
|
|
||||||
assert_nothing_raised(Exception) do
|
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
|
valid_syntax? IO::read(script), script
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue