aboutsummaryrefslogtreecommitdiffstats
path: root/test/stringio
Commit message (Collapse)AuthorAgeFilesLines
* 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
* * test/stringio/test_stringio.rb (test_ungetc_pos): added.nobu2009-02-121-0/+15
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22254 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_insnhelper.c (vm_call_method, vm_call_cfunc): use original id instead ofko12008-12-271-0/+15
| | | | | | | | | | | | | 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
* * ext/stringio/stringio.c (strio_init): rewind when reopened.mame2008-06-111-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17102 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/stringio/test_stringio.rb: add tests to achieve over 95% testmame2008-06-051-0/+314
| | | | | | | | | 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
* add tests for [ruby-dev:34591].akr2008-05-121-0/+25
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16378 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* use ML ref. for assertion message.akr2007-11-181-6/+6
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/stringio/stringio.c (strio_write): insufficiently filled stringnobu2004-11-291-0/+10
| | | | | | | being extended when overwriting. [ruby-core:03836] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/stringio/stringio.c (strio_write): zero fill a gap if exsts.nobu2004-09-081-1/+1
| | | | | | | [ruby-dev:24190] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* add test for [ruby-dev:24060], [ruby-dev:24065], [ruby-dev:24103],akr2004-09-071-0/+16
| | | | | | | | [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
* * ext/stringio/stringio.c (strio_read): adjust behavior at readingnobu2003-12-101-0/+2
| | | | | | | | | | | | | 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
* ditto.akr2003-12-091-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5150 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/stringio/stringio.c (strio_read): follow IO#read.nobu2003-12-051-9/+8
| | | | | | | | * 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
* * test/stringio/test_stringio.rb: imported from [ruby-dev:21941].nobu2003-11-181-0/+15
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e