Bug #11885 ยป 0001-IO-readpartial-rejects-bad-args.patch
| ChangeLog | ||
|---|---|---|
|
Sun Dec 27 14:49:52 2015 Eric Wong <e@80x24.org>
|
||
|
* io.c (io_getpartial): remove unused kwarg from template
|
||
|
* test/ruby/test_io.rb (test_readpartial_bad_args): new
|
||
|
Sun Dec 27 11:47:46 2015 Kuniaki IGARASHI <igaiga@gmail.com>
|
||
|
* test/ruby/test_string.rb (test_insert): The test cases are
|
||
| io.c | ||
|---|---|---|
|
long n, len;
|
||
|
struct read_internal_arg arg;
|
||
|
rb_scan_args(argc, argv, "11:", &length, &str, NULL);
|
||
|
rb_scan_args(argc, argv, "11", &length, &str);
|
||
|
if ((len = NUM2LONG(length)) < 0) {
|
||
|
rb_raise(rb_eArgError, "negative length %ld given", len);
|
||
| test/ruby/test_io.rb | ||
|---|---|---|
|
}
|
||
|
end
|
||
|
def test_readpartial_bad_args
|
||
|
IO.pipe do |r, w|
|
||
|
w.write '.'
|
||
|
buf = String.new
|
||
|
assert_raise(ArgumentError) { r.readpartial(1, buf, exception: false) }
|
||
|
assert_raise(TypeError) { r.readpartial(1, exception: false) }
|
||
|
assert_equal [[r],[],[]], IO.select([r], nil, nil, 1)
|
||
|
assert_equal '.', r.readpartial(1)
|
||
|
end
|
||
|
end
|
||
|
def test_sysread_unlocktmp_ensure
|
||
|
bug8669 = '[ruby-core:56121] [Bug #8669]'
|
||
|
-
|
||