aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_argf.rb
Commit message (Collapse)AuthorAgeFilesLines
* delete deprecated IO-like methods卜部昌平2020-12-031-35/+2
| | | | | | | | | This commit deletes {IO,ARGF,StringIO,Zib::GZipReader}#{bytes,chars,lines,codepoints}, which have been deprecated since c47c095b9740e7c19d6fdca29ab661c1089221d4. Note that String also has those methods. They are neither depreacted nor deleted because they are not aliases of counterpart each_something.
* Disable deprecation warning by the default [Feature #16345]Nobuyoshi Nakada2020-09-251-4/+0
| | | | And `-w` option turns it on.
* Fix corruption in ARGF.inplacePeter Zhu2020-08-121-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | Extension string stored in `ARGF.inplace` is created using an api designed for C string constants to create a Ruby string that points at another Ruby string. When the original string is swept, the extension string gets corrupted. Reproduction script (on MacOS): ```ruby #!/usr/bin/ruby -pi.bak BEGIN { GC.start(full_mark: true) arr = [] 1000000.times do |x| arr << "fooo#{x}" end } puts "hello" ``` Co-Authored-By: Matt Valentine-House <31869+eightbitraptor@users.noreply.github.com>
* Pass keyword arguments to IOs properly [Bug #16639]Nobuyoshi Nakada2020-02-181-0/+7
|
* Fix error when Encoding.default_external is Encoding::IBM437kazu2018-08-091-5/+5
| | | | | | | | | | | https://ci.appveyor.com/project/ruby/ruby/build/1.0.9151#L4601 ``` 1) Error: TestArgf#test_inplace_nonascii: Encoding::UndefinedConversionError: U+3042 from UTF-8 to IBM437 ``` git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64249 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Skip test_inplace_nonascii if external encoding is us-asciikazu2018-08-091-0/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64246 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io.c: fix non-ascii filename inplace editnobu2018-08-091-2/+19
| | | | | | | * io.c (argf_next_argv): convert filename to the OS encoding to be dealt with by system calls. [ruby-dev:50607] [Bug #14970] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io.c: encoding of ARGF.inplace_modenobu2017-10-101-0/+23
| | | | | | | * io.c (argf_next_argv): encode inplace mode suffix to the path encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io.c: path name conversion at ARGFnobu2017-10-101-0/+28
| | | | | | | * io.c (argf_next_argv): the standard conversion to path name should take place. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io.c: check null charnobu2017-10-021-0/+6
| | | | | | | | * io.c (ruby_set_inplace_mode): check if null is contained. based on the patch by tommy (Masahiro Tomita) in [ruby-dev:50272]. [Bug #13960] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_argf.rb: indent here docsnobu2017-10-021-311/+367
| | | | | | | | | | * test/ruby/test_argf.rb (assert_src_expected): default line number to caller's location. * test/ruby/test_argf.rb (test_lineno, test_lineno2): get rid of a bug of wrong indentation after $. in Emacs 25.3 ruby-mode.el git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/ruby: tweaked heredocsnobu2017-08-291-1/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59682 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io.c: ARGF fd leaknobu2016-12-271-1/+7
| | | | | | | * io.c (argf_next_argv): fix leak of fd after breaking in #each method. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io.c: update argf linenonobu2016-12-201-7/+10
| | | | | | | * io.c (argf_rewind): rewind line number in non-global ARGF instance. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57125 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io.c: update argf linenonobu2016-12-201-0/+12
| | | | | | | * io.c (argf_block_call_line): update line number in non-global ARGF instance. [ruby-core:78728] [Bug #13051] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57124 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
* * io.c (argf_getpartial): should not resize str if the secondshugo2015-11-251-0/+11
| | | | | | | argument is not given. [ruby-core:71668] [Bug #11738] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52745 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io.c: check ARGV element typenobu2015-10-221-0/+8
| | | | | | | * io.c (argf_next_argv): check ARGV element type, and try conversion if necessary. [ruby-core:71140] [Bug #11610] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52211 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io.c (argf_read_nonblock): support `exception: false'normal2015-07-171-0/+43
| | | | | | | | | | | | | | | | | This is a preparation for [ruby-core:69892] ("io.c: avoid kwarg parsing in C API") since I noticed ARGF.read_nonblock did not properly catch up to the `exception: false' change. * io.c (argf_read_nonblock): support `exception: false' (io_nonblock_eof): new function (io_read_nonblock): use io_nonblock_eof (argf_getpartial): accept kwargs hash for `exception: false' * test/ruby/test_argf.rb (test_read_nonblock): new test [ruby-core:70000] [Feature #11358] * NEWS: add item for ARGF.read_nonblock git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51285 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/lib/envutil.rb: Moved from test/ruby/.akr2014-11-131-1/+0
| | | | | | | | | | | | | | * test/lib/find_executable.rb: Ditto. * test/lib/memory_status.rb: Ditto. * test/lib/test/unit.rb: require envutil. * test/: Don't require envutil in test files. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io.c: preserve encodingsnobu2014-08-281-0/+7
| | | | | | * io.c (argf_next_argv): preserve encodings in warning messages. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/ruby: assert_raise_with_messagenobu2013-10-091-2/+1
| | | | | | * test/ruby: use assert_raise_with_message git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43224 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Specify external_encodingnaruse2013-03-301-6/+2
| | | | | | http://c5664.rubyci.org/~chkbuild/ruby-trunk/log/20130329T090301Z.diff.html.gz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40007 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io.c: get rid of IOError when skipped while iterationnobu2013-03-291-0/+5
| | | | | | | | | | * io.c (argf_next_argv): set init flag if succeeded to forward, after skipping. * io.c (argf_block_call_i, argf_block_call): no more forwarding if forwarded after skipping. [ruby-list:49185] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39997 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io.c: get rid of IOError when skipped while iterationnobu2013-03-291-0/+38
| | | | | | | | | * io.c (argf_close): deal with init flag. * io.c (argf_block_call_i, argf_block_call): forward next file if skipped while iteration, to get rid of IOError. [ruby-list:49185] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_argf.rb: duplicated testnobu2012-12-241-10/+0
| | | | | | | * test/ruby/test_argf.rb (TestArgf#test_lines): remove duplicated test whose content is test_bytes actually. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38581 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Deprecate #{lines,bytes,chars,codepoints} of IO-likes.knu2012-12-221-3/+31
| | | | | | | | | | | | | | | * io.c (rb_io_lines, rb_io_bytes, rb_io_chars, rb_io_codepoints): Deprecate IO#{lines,bytes,chars,codepoints} and those of ARGF. [Feature #6670] * ext/stringio/stringio.c (strio_lines, strio_bytes, strio_chars) (strio_codepoints): Deprecate StringIO#{lines,bytes,chars,codepoints}. [Feature #6670] * ext/zlib/zlib.c (rb_gzreader_lines, rb_gzreader_bytes): Deprecate Zlib::GzipReader#{lines,bytes}. [Feature #6670] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38563 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_argf.rb (TestArgf#test_chars): since marshal data isusa2012-11-261-2/+2
| | | | | | | binary, shouldn't pass via text mode. use base64 encoded data. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (argf_each_codepoint): add missing ARGF#codepoints [Bug #7438]naruse2012-11-261-0/+24
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37851 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* increment @tmp_count.akr2012-07-181-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36451 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_argf.rb: use temporally directory.akr2012-07-181-13/+14
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36445 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (io_readpartial): Document the output buffer parameter isdrbrain2012-04-181-0/+12
| | | | | | | | | | | | | | | | | | 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
* * io.c (argf_next_argv): reset ARGF.next_p on ARGV.replace.naruse2012-02-021-0/+10
| | | | | | | r34409 breaks replacing ARGV. [ruby-dev:45160] [Bug #5952] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_argf.rb (test_readlines_twice_tty): removed incomplete test ↵nobu2012-02-011-15/+0
| | | | | | committed accidentally. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34412 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (argf_close): skip stdin, which should be readable again.nobu2012-01-311-0/+20
| | | | | | | | [ruby-dev:45160] [Bug #5952] * io.c (argf_readlines): reinitialize after all read to be readable again. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (argf_next_argv): open in default text mode.nobu2011-09-031-1/+12
| | | | | | [ruby-core:39234] [Bug #5268] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33171 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * util.c, include/ruby/util.h (ruby_add_suffix): remove the function.usa2011-08-031-11/+4
| | | | | | | | | | | | | | | | | | | | | | [Bug #5153] [ruby-core:38736] * io.c (argf_next_argv): remove the call of above function. * ext/-test-/add_suffix, test/-ext-/test_add_suffix.rb: remove the test extension module because this is only for testsing ruby_add_suffix(). * LEGAL: remove the mention about a part of util.c, because now we removed the part. * io.c (argf_next_argv): now the new filename is not guranteed to use, so should check the return value of rename(2). * test/ruby/test_argf.rb (TestArgf#test_inplace_rename_impossible): now we expect same result with other platforms on no_safe_rename platforms (=Windows). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (argf_next_argv): go advance when the next file cannot benobu2011-01-131-0/+15
| | | | | | read. [ruby-core:34446] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_argf.rb (test_inplace_rename_impossible): unlinkusa2010-12-141-4/+14
| | | | | | | | | | | | the renamed temporary file on no_safe_rename platforms. * test/ruby/test_argf.rb (test_readlines_limit_0, test_each_line_limit_0): should close argf because the associated Tempfile object cannot unlink the temporary file when it's gc'ed on some platforms (Windows, etc.) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (argf_readlines): forward to current_file for argumentsnobu2010-11-141-0/+18
| | | | | | | check. http://twitter.com/nagachika/status/3634254856589312 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_io_getline_fast, rb_io_getline_1): fix ARGF.lineno behavior. ↵kazu2010-04-111-0/+8
| | | | | | | | [ruby-core:25205] * test/ruby/test_argf.rb (TestArgf#test_lineno3): add a test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27308 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* remove temporally files explicitly.akr2009-09-131-1/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24908 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* make tempfile prefix more descriptive.akr2009-09-131-6/+6
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_argf.rb (assert_src_expected): refactored.nobu2009-08-311-53/+29
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24719 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (argf_eof): go to the next file if called after ARGF.closenobu2009-07-261-0/+12
| | | | | | | or ARGF.skip. [ruby-core:24561] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24284 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (argf_eof): should not have reached EOF before trying tonobu2009-07-251-4/+4
| | | | | | | | read. based on a patch by Heesob Park <phasis AT gmail.com> at [ruby-core:24559]. [ruby-core:24557] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24271 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_argf.rb (TestArgf#test_skip): updated testmatz2009-06-161-6/+2
| | | | | | according to clarified behavior. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23706 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_argf.rb (test_readpartial2): readpartial works just likeusa2008-10-281-0/+2
| | | | | | | binmode, so input of it should be binmode'ed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_argf.rb (test_{argf,lineno,lineno2}): don't repeatnobu2008-10-271-16/+17
| | | | | | | comments and expected results. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/envutil.rb (Test::Unit::Assertions#assert_in_out_err): newmame2008-07-151-118/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | method. * test/ruby/test_argf.rb: use assert_in_out_err instead of EnvUtil.rubyexec. * test/ruby/test_module.rb: ditto. * test/ruby/test_require.rb: ditto. * test/ruby/test_objectspace.rb: ditto. * test/ruby/test_object.rb: ditto. * test/ruby/test_string.rb: ditto. * test/ruby/test_method.rb: ditto. * test/ruby/test_variable.rb: ditto. * test/ruby/test_io.rb: ditto. * test/ruby/test_rubyoptions.rb: ditto. * test/ruby/test_exception.rb: ditto. * test/ruby/test_class.rb: ditto. * test/ruby/test_thread.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18082 b2dd03c8-39d4-4d8f-98ff-823fe69b080e