summaryrefslogtreecommitdiff
path: root/test/stringio
AgeCommit message (Collapse)Author
2018-08-07Support old versions of Ruby with FrozenError.hsbt
They should work separatedly from Ruby core repository. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64215 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-12Add FrozenError as a subclass of RuntimeErrorshyouhei
FrozenError will be used instead of RuntimeError for exceptions raised when there is an attempt to modify a frozen object. The reason for this change is to differentiate exceptions related to frozen objects from generic exceptions such as those generated by Kernel#raise without an exception class. From: Jeremy Evans <code@jeremyevans.net> Signed-off-by: Urabe Shyouhei <shyouhei@ruby-lang.org> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-23stringio.c: write multiple argumentsnobu
* ext/stringio/stringio.c (strio_write_m): make StringIO#write accept multiple arguments, as well as IO#write. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-13stringio.c: encoding at empty chomped resultnobu
* ext/stringio/stringio.c (strio_gets): should return string with the external encoding, at empty chomped result . git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-13stringio.c: encoding at empty resultnobu
* ext/stringio/stringio.c (strio_gets): should return string with the external encoding, at empty result. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59581 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-12stringio.c: encoding at EOFnobu
* ext/stringio/stringio.c (strio_read): should return string with the external encoding, at EOF too. [ruby-core:82349] [Bug #13806] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59578 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-12test_stringio.rb: more assertionsnobu
* test/stringio/test_stringio.rb (test_read): add assertions of return value of read with a buffer string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-21stringio.c: check rangenobu
* ext/stringio/stringio.c (strio_ungetc): raise RangeError instead of TypeError at too big value, as well as IO#ungetc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58041 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-21stringio.c: check character codenobu
* ext/stringio/stringio.c (strio_ungetc): check if the character code is valid in the encoding. reported by Ahmad Sherif (ahmadsherif) at https://hackerone.com/reports/209593. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58040 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-10stringio.c: chomp CRnobu
* ext/stringio/stringio.c (strio_getline): chomp CR not only LF, as well as String#chomp. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-03stringio: chomp optionnobu
* ext/stringio/stringio.c (strio_getline): implement chomp option. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-03test_stringio.rb: paragraph modenobu
* test/stringio/test_stringio.rb (test_gets, test_each): assertions for paragraph mode. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-26stringio.c: fix signed integer overflowrhe
* ext/stringio/stringio.c (strio_seek): Avoid signed integer overflow. It's not harmful in practice here, but is still undefined behavior. * ext/stringio/stringio.c (strio_extend): Check that the new length does not exceed LONG_MAX. This fixes the invalid write on the overflow. * test/stringio/test_stringio.rb (test_write_integer_overflow): Add a test case for the above fix in strio_extend(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56253 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-06require "rbconfig/sizeof"naruse
They may fail parallel test-all git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55602 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-30test_stringio.rb: reduce retry countnobu
* test/stringio/test_stringio.rb (test_overflow): reduce maximum retry count to get rid of timeout on some platforms. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55544 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-18Refine test of r55432nobu
* test/stringio/test_stringio.rb (test_overflow): could occur only on sizeof(long) >= sizeof(void*). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55440 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-18Refine test of r55432nobu
* test/stringio/test_stringio.rb (test_overflow): refine the conditinon, try to allocate strings until the buffer is located in higher half address. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-17stringio.c: fix index overflownobu
* ext/stringio/stringio.c (strio_getline): fix pointer index overflow. reported by Guido Vranken <guido AT guidovranken.nl>. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55432 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-27stringio.c: warn block for newnobu
* ext/stringio/stringio.c (strio_s_new): warn if a block is given, as well as IO.new. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-04stringio: binmode sets encoding to ASCII-8BITnormal
This should match the behavior of IO#binmode as far as treating content as ASCII-8BIT (binary). * ext/stringio/stringio.c (strio_binmode): implement to set encoding * test/stringio/test_stringio.rb (test_binmode): new test [ruby-core:72699] [Bug #11945] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-29test_stringio.rb: test_initializenobu
* test/stringio/test_stringio.rb (test_initialize): add test for StringIO#initialize. [ruby-core:72585] [Feature #11920] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53378 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-18stringio.c: separate encoding from buffernobu
* ext/stringio/stringio.c (strio_set_encoding): add StringIO's own encoding and separate it from the buffer string to override the encoding of string when reading. [ruby-core:72189] [Bug #11827] note that setting the encoding of its buffer string may cause unpredictable behavior. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-18stringio.c: padding in ungetbytenobu
* ext/stringio/stringio.c (strio_ungetbyte): pad with \000 when the current position is after the end. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53181 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-18test_stringio.rb: add testnobu
* test/stringio/test_stringio.rb (test_ungetc_pos): add a test for r26588. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-16Add frozen_string_literal: false for all filesnaruse
When you change this to true, you may need to add more tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-11Simple testing for StringIO#sysreadnobu
* test/stringio/test_stringio.rb (test_sysread): add a test for StringIO#sysread. [Fix GH-966] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51219 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-13stringio.c: don't raise after closenobu
* ext/stringio/stringio.c (strio_close): don't raise on dobule close for consistent to IO#close. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-09stringio.c: don't raise after closenobu
* ext/stringio/stringio.c (strio_close): don't raise on dobule close for consistent to IO#close. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-26stringio.c: ASCII-8BIT StringIO rejects no encodingsnobu
* ext/stringio/stringio.c (strio_write): ASCII-8BIT StringIO should be writable any encoding strings, without conversion. [ruby-core:65240] [Bug #10285] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-23stringio.c: use rb_str_append other than ASCII-8BITnobu
* ext/stringio/stringio.c (strio_write): use rb_str_append to reuse coderange bits other than ASCII-8BIT, and keep taintedness. [ruby-dev:48118] [Bug #9769] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-22Revert r45670 "stringio.c: use rb_str_append"naruse
It breaks test-all. http://u64b.rubyci.org/~chkbuild/ruby-trunk/log/20140422T143301Z.diff.html.gz rb_str_conv_enc() return original string for example when from ASCII-8BIT to UTF-8 with non ASCII strings git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-22stringio.c: use rb_str_appendnobu
* ext/stringio/stringio.c (strio_write): use rb_str_append to reuse coderange bits and keep taintedness. [ruby-dev:48118] [Bug #9769] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45670 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-21stringio.c: non-ascii encodingnobu
* ext/stringio/stringio.c (strio_putc): fix for non-ascii encoding, like as IO#putc. [ruby-dev:48114] [Bug #9765] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45646 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-26* io.c (io_read_nonblock): support non-blocking reads without raisingtenderlove
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
2012-12-27* ext/stringio/stringio.c (strio_getline): fix not to raise TypeErrorglass
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* ext/stringio/stringio.c (strio_ungetc): raise IOError instead of RuntimeErrorglass
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-10-29stringio.c: close separatedlynobu
* 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-04-18* io.c (io_readpartial): Document the output buffer parameter isdrbrain
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
2011-08-20* ext/stringio/stringio.c (strio_read): return new string if nilnobu
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-04-09* ext/stringio/stringio.c (strio_each):sorah
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* ext/stringio/stringio.c (strio_each, strio_readlines):sorah
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-08* ext/stringio/stringio.c (strio_getline): check whether str isnaruse
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-01-05* ext/stringio/stringio.c (get_strio, strio_set_string)nobu
(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
2010-12-02* ext/stringio/stringio.c (strio_getline): round upto next charnobu
boundary. [ruby-dev:42674] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30063 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-04 * ext/stringio/stringio.c (ungetc): RDoc updated. trunk allowsnahi
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-10-27* ext/stringio/stringio.c (Init_stringio): added read_nonblock andnobu
write_nonblock aliases. [ruby-dev:39551] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25517 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-28* stringio/stringio.c (strio_read): set ASCII-8BIT encodingnaruse
when length argument is given. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25127 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-12* test: use require_relative.naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24878 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-22* ext/stringio/stringio.c (strio_each_codepoint): new method.matz
[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-05-14* ext/stringio/stringio.c (strio_ungetbyte): encoding should notnobu
be effective. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23424 b2dd03c8-39d4-4d8f-98ff-823fe69b080e