Граф коммитов

32 Коммитов

Автор SHA1 Сообщение Дата
tenderlove 988ca60565 * io.c (io_read_nonblock): support non-blocking reads without raising
exceptions. As in: `io.read_nonblock(size, exception: false)`
  [ruby-core:38666] [Feature #5138]
* ext/openssl/ossl_ssl.c (ossl_ssl_read_internal): ditto
* ext/stringio/stringio.c (strio_sysread): ditto
* io.c (rb_io_write_nonblock): support non-blocking writes without
  raising an exception.
* ext/openssl/ossl_ssl.c (ossl_ssl_write_internal): ditto
* test/openssl/test_pair.rb (class OpenSSL): tests
* test/ruby/test_io.rb (class TestIO): ditto
* test/socket/test_nonblock.rb (class TestSocketNonblock): ditto
* test/stringio/test_stringio.rb (class TestStringIO): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42695 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-26 22:41:44 +00:00
glass 89182621d9 * ext/stringio/stringio.c (strio_getline): fix not to raise TypeError
when limit is nil.
  [Bug #7232] [ruby-core:48531]

* test/stringio/test_stringio.rb: a test for above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38630 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-27 12:21:17 +00:00
glass cd453f16b4 * ext/stringio/stringio.c (strio_ungetc): raise IOError instead of RuntimeError
if the string is frozen.
  [Bug #7231] [ruby-core:48530]

* ext/stringio/stringio.c (strio_ungetbyte): ditto.

* test/stringio/test_stringio.rb: a test for above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38628 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-27 11:43:02 +00:00
nobu 56f9574de8 stringio.c: close separatedly
* ext/stringio/stringio.c (strio_close): close separatedly per each
  instances, as well as IO.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-29 09:23:02 +00:00
drbrain ab0eb272f9 * io.c (io_readpartial): Document the output buffer parameter is
overwritten with the read contents even when non-empty.
  Patch by yu nobuoka.  [ruby-trunk - Bug #6285]
* io.c (io_read_nonblock):  ditto.
* io.c (io_read):  ditto.
* io.c (rb_io_sysread):  ditto.
* io.c (argf_read):  ditto.
* io.c (argf_readpartial):  ditto.
* ext/stringio/stringio.c (strio_read):  ditto.
* test/ruby/test_argf.rb (class TestArgf):  Add test for existing
  behavior of read outbuf.
* test/ruby/test_io.rb (class TestIO):  ditto.
* test/stringio/test_stringio.rb (class TestStringIO):  ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-18 23:48:27 +00:00
nobu dcb7cc1a8b * ext/stringio/stringio.c (strio_read): return new string if nil
is explicitly given as a buffer ([Bug #5207]), otherwise set the
  encoding.  also removed dead code.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33010 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-20 01:43:26 +00:00
sorah 4e817b39b4 * ext/stringio/stringio.c (strio_each):
Fix exception message and don't raise immediately if block is not given.
  Fixes [ruby-dev:43394].

* test/stringio/test_stringio.rb (test_each_line_limit_0):
  Fix test for above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31253 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-09 14:28:06 +00:00
sorah 0a69f2e39d * ext/stringio/stringio.c (strio_each, strio_readlines):
limit must not be zero. Fixes [ruby-dev:43392].

* test/stringio/test_stringio.rb: Add tests for above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31252 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-09 13:01:23 +00:00
naruse 653b4248a3 * ext/stringio/stringio.c (strio_getline): check whether str is
a string when str and lim are given.
  https://twitter.com/watson1978/status/56225052152168449

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31248 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-08 07:50:49 +00:00
nobu d8d9bac5c8 * ext/stringio/stringio.c (get_strio, strio_set_string)
(strio_reopen): check if frozen.  [ruby-core:33648]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30467 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-05 20:14:43 +00:00
nobu bfcd4e5453 * ext/stringio/stringio.c (strio_getline): round upto next char
boundary.  [ruby-dev:42674]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30063 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-02 22:08:45 +00:00
nahi 39802186b2 * ext/stringio/stringio.c (ungetc): RDoc updated. trunk allows
pushing back behind the beginning of the pseudo stream.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25987 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-04 04:14:37 +00:00
nobu 8252adfd5a * ext/stringio/stringio.c (Init_stringio): added read_nonblock and
write_nonblock aliases.  [ruby-dev:39551]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25517 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-27 13:22:40 +00:00
naruse b07650769e * stringio/stringio.c (strio_read): set ASCII-8BIT encoding
when length argument is given.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25127 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-28 01:08:24 +00:00
naruse 6bbed0e31b * test: use require_relative.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24878 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-12 17:00:51 +00:00
matz fa31dda1f8 * ext/stringio/stringio.c (strio_each_codepoint): new method.
[ruby-core:23949]

* ext/stringio/stringio.c (strio_each_codepoint): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23818 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-22 08:23:30 +00:00
nobu af634f8455 * ext/stringio/stringio.c (strio_ungetbyte): encoding should not
be effective.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23424 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-14 07:07:55 +00:00
nobu 090dc8fd54 * test/stringio/test_stringio.rb (test_path): StringIO#path is no
longer defined.  [ruby-dev:38254]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-06 01:49:48 +00:00
nobu 287a34ae0d * {ext,lib,test}/**/*.rb: removed trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-06 03:56:38 +00:00
nobu 48149dff32 * test/stringio/test_stringio.rb (test_ungetc_pos): added.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22254 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-12 10:41:48 +00:00
ko1 b30b998966 * vm_insnhelper.c (vm_call_method, vm_call_cfunc): use original id instead of
calling id when NODE_CFUNC or NODE_BMETHOD.
  fixes Bug #632 [ruby-core:19282].
* vm_eval.c (vm_call0, vm_call_super): ditto.
* vm_method.c (rb_add_method, rb_alias): store original id
  in nd_file field of NODE_METHOD.
* test/stringio/test_stringio.rb: add a test.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21084 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-27 03:57:21 +00:00
mame d222472299 * ext/stringio/stringio.c (strio_init): rewind when reopened.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17102 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-11 17:50:03 +00:00
mame 437af4f46f * test/stringio/test_stringio.rb: add tests to achieve over 95% test
coverage of stringio.

* test/strscan/test_stringscanner.rb: ditto for strscan.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16847 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-05 14:33:01 +00:00
akr 10fc0eb781 add tests for [ruby-dev:34591].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16378 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-12 03:37:58 +00:00
akr 68543f3092 use ML ref. for assertion message.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-18 07:18:56 +00:00
nobu af7418e5c4 * ext/stringio/stringio.c (strio_write): insufficiently filled string
being extended when overwriting.  [ruby-core:03836]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-29 07:06:21 +00:00
nobu a838eb5c65 * ext/stringio/stringio.c (strio_write): zero fill a gap if exsts.
[ruby-dev:24190]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-09-08 09:44:46 +00:00
akr 08907d87e0 add test for [ruby-dev:24060], [ruby-dev:24065], [ruby-dev:24103],
[ruby-dev:24190], [ruby-dev:24191], [ruby-dev:24194], [ruby-dev:24197],
[ruby-dev:24202], [ruby-dev:24213], [ruby-dev:24223] and [ruby-dev:24228].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-09-07 05:32:26 +00:00
nobu 6395c3b38d * 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
2003-12-10 08:16:14 +00:00
akr 1c09059ed8 ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5150 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-09 05:35:16 +00:00
nobu 7fbf13f7f2 * ext/stringio/stringio.c (strio_read): follow IO#read.
* test/ruby/ut_eof.rb, test/ruby/test_file.rb, test/ruby/test_pipe.rb,
  test/stringio/test_stringio.rb: add EOF test.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5115 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-05 02:54:48 +00:00
nobu 0c15b3a222 * test/stringio/test_stringio.rb: imported from [ruby-dev:21941].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-11-18 09:23:07 +00:00