aboutsummaryrefslogtreecommitdiffstats
path: root/test/stringio
Commit message (Collapse)AuthorAgeFilesLines
* stringio.c: write multiple argumentsnobu2017-10-231-0/+10
| | | | | | | * 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
* stringio.c: encoding at empty chomped resultnobu2017-08-131-0/+2
| | | | | | | * 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
* stringio.c: encoding at empty resultnobu2017-08-131-0/+2
| | | | | | | * 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
* stringio.c: encoding at EOFnobu2017-08-121-0/+11
| | | | | | | | * 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
* test_stringio.rb: more assertionsnobu2017-08-121-2/+2
| | | | | | | * 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
* stringio.c: check rangenobu2017-03-211-0/+1
| | | | | | | * 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
* stringio.c: check character codenobu2017-03-211-0/+2
| | | | | | | | * 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
* stringio.c: chomp CRnobu2016-12-101-0/+20
| | | | | | | * 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
* stringio: chomp optionnobu2016-12-031-0/+19
| | | | | | * 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
* test_stringio.rb: paragraph modenobu2016-12-031-0/+5
| | | | | | | * 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
* stringio.c: fix signed integer overflowrhe2016-09-261-0/+9
| | | | | | | | | | | | | * 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
* require "rbconfig/sizeof"naruse2016-07-061-0/+1
| | | | | | They may fail parallel test-all git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55602 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_stringio.rb: reduce retry countnobu2016-06-301-1/+1
| | | | | | | * 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
* Refine test of r55432nobu2016-06-181-1/+2
| | | | | | | * 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
* Refine test of r55432nobu2016-06-181-1/+7
| | | | | | | | * 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
* stringio.c: fix index overflownobu2016-06-171-0/+12
| | | | | | | * 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
* stringio.c: warn block for newnobu2016-04-271-0/+6
| | | | | | | * 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
* stringio: binmode sets encoding to ASCII-8BITnormal2016-01-041-0/+9
| | | | | | | | | | | 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
* test_stringio.rb: test_initializenobu2015-12-291-0/+21
| | | | | | | * 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
* stringio.c: separate encoding from buffernobu2015-12-181-0/+7
| | | | | | | | | | * 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
* stringio.c: padding in ungetbytenobu2015-12-181-0/+30
| | | | | | | * 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
* test_stringio.rb: add testnobu2015-12-181-0/+10
| | | | | | | * 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
* Add frozen_string_literal: false for all filesnaruse2015-12-161-0/+1
| | | | | | 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
* Simple testing for StringIO#sysreadnobu2015-07-111-0/+10
| | | | | | | * 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
* stringio.c: don't raise after closenobu2015-03-131-2/+2
| | | | | | | * 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
* stringio.c: don't raise after closenobu2015-03-091-2/+2
| | | | | | | * 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
* stringio.c: ASCII-8BIT StringIO rejects no encodingsnobu2014-09-261-0/+12
| | | | | | | | * 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
* stringio.c: use rb_str_append other than ASCII-8BITnobu2014-04-231-0/+18
| | | | | | | | * 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
* Revert r45670 "stringio.c: use rb_str_append"naruse2014-04-221-11/+0
| | | | | | | | | | 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
* stringio.c: use rb_str_appendnobu2014-04-221-0/+11
| | | | | | | | * 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
* stringio.c: non-ascii encodingnobu2014-04-211-0/+16
| | | | | | | * 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
* * io.c (io_read_nonblock): support non-blocking reads without raisingtenderlove2013-08-261-2/+22
| | | | | | | | | | | | | | | | 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
* * ext/stringio/stringio.c (strio_getline): fix not to raise TypeErrorglass2012-12-271-1/+1
| | | | | | | | | 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
* * ext/stringio/stringio.c (strio_ungetc): raise IOError instead of RuntimeErrorglass2012-12-271-0/+8
| | | | | | | | | | | 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
* stringio.c: close separatedlynobu2012-10-291-1/+1
| | | | | | | | * 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
* * io.c (io_readpartial): Document the output buffer parameter isdrbrain2012-04-181-0/+13
| | | | | | | | | | | | | | | | | | 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
* * ext/stringio/stringio.c (strio_read): return new string if nilnobu2011-08-201-0/+8
| | | | | | | | 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
* * ext/stringio/stringio.c (strio_each):sorah2011-04-091-1/+2
| | | | | | | | | | 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
* * ext/stringio/stringio.c (strio_each, strio_readlines):sorah2011-04-091-0/+8
| | | | | | | | 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
* * ext/stringio/stringio.c (strio_getline): check whether str isnaruse2011-04-081-0/+2
| | | | | | | 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
* * ext/stringio/stringio.c (get_strio, strio_set_string)nobu2011-01-051-0/+9
| | | | | | | (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
* * ext/stringio/stringio.c (strio_getline): round upto next charnobu2010-12-021-0/+6
| | | | | | boundary. [ruby-dev:42674] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30063 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/stringio/stringio.c (ungetc): RDoc updated. trunk allowsnahi2009-12-041-1/+1
| | | | | | | 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
* * ext/stringio/stringio.c (Init_stringio): added read_nonblock andnobu2009-10-271-0/+40
| | | | | | | write_nonblock aliases. [ruby-dev:39551] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25517 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * stringio/stringio.c (strio_read): set ASCII-8BIT encodingnaruse2009-09-281-1/+4
| | | | | | when length argument is given. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25127 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test: use require_relative.naruse2009-09-121-4/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24878 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/stringio/stringio.c (strio_each_codepoint): new method.matz2009-06-221-0/+5
| | | | | | | | [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
* * ext/stringio/stringio.c (strio_ungetbyte): encoding should notnobu2009-05-141-0/+15
| | | | | | | be effective. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23424 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/stringio/test_stringio.rb (test_path): StringIO#path is nonobu2009-04-061-4/+0
| | | | | | | longer defined. [ruby-dev:38254] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * {ext,lib,test}/**/*.rb: removed trailing spaces.nobu2009-03-061-4/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e