summaryrefslogtreecommitdiff
path: root/test/ruby/test_argf.rb
AgeCommit message (Collapse)Author
2022-07-07[Bug #18892] Reset `ARGF.lineno` after reading shebangNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/6097
2022-01-04Use omit instead of skip: test/ruby/**/*.rbHiroshi SHIBATA
2021-08-10Assert for duplicated ARGF [Bug #18074]Nobuyoshi Nakada
2021-08-10Assert that each contents are read [Bug #18074]Nobuyoshi Nakada
2021-08-10Fix ARGF.read(length) short read [Bug #18074]Csaba Henk
Notes: Merged: https://github.com/ruby/ruby/pull/4727
2021-02-08Forward keyword arguments to ARGF from global functionsNobuyoshi Nakada
2021-02-08Added test for keyword arguments to ARGFNobuyoshi Nakada
2020-12-03delete deprecated IO-like methods卜部昌平
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.
2020-09-25Disable deprecation warning by the default [Feature #16345]Nobuyoshi Nakada
And `-w` option turns it on. Notes: Merged: https://github.com/ruby/ruby/pull/3481
2020-08-12Fix corruption in ARGF.inplacePeter Zhu
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> Notes: Merged: https://github.com/ruby/ruby/pull/3409 Merged-By: nobu <nobu@ruby-lang.org>
2020-02-18Pass keyword arguments to IOs properly [Bug #16639]Nobuyoshi Nakada
2018-08-09Fix error when Encoding.default_external is Encoding::IBM437kazu
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
2018-08-09Skip test_inplace_nonascii if external encoding is us-asciikazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64246 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-09io.c: fix non-ascii filename inplace editnobu
* 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
2017-10-10io.c: encoding of ARGF.inplace_modenobu
* 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
2017-10-10io.c: path name conversion at ARGFnobu
* 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
2017-10-02io.c: check null charnobu
* 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
2017-10-02test_argf.rb: indent here docsnobu
* 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
2017-08-29test/ruby: tweaked heredocsnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59682 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-27io.c: ARGF fd leaknobu
* 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
2016-12-20io.c: update argf linenonobu
* 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
2016-12-20io.c: update argf linenonobu
* 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
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-11-25* io.c (argf_getpartial): should not resize str if the secondshugo
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
2015-10-22io.c: check ARGV element typenobu
* 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
2015-07-17io.c (argf_read_nonblock): support `exception: false'normal
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
2014-11-13* test/lib/envutil.rb: Moved from test/ruby/.akr
* 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
2014-08-28io.c: preserve encodingsnobu
* 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
2013-10-09test/ruby: assert_raise_with_messagenobu
* test/ruby: use assert_raise_with_message git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43224 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-30Specify external_encodingnaruse
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
2013-03-29io.c: get rid of IOError when skipped while iterationnobu
* 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
2013-03-29io.c: get rid of IOError when skipped while iterationnobu
* 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
2012-12-24test_argf.rb: duplicated testnobu
* 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
2012-12-22Deprecate #{lines,bytes,chars,codepoints} of IO-likes.knu
* 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
2012-11-26* test/ruby/test_argf.rb (TestArgf#test_chars): since marshal data isusa
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
2012-11-26* io.c (argf_each_codepoint): add missing ARGF#codepoints [Bug #7438]naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37851 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-18increment @tmp_count.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36451 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-18* test/ruby/test_argf.rb: use temporally directory.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36445 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
2012-02-02* io.c (argf_next_argv): reset ARGF.next_p on ARGV.replace.naruse
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
2012-02-01* test/ruby/test_argf.rb (test_readlines_twice_tty): removed incomplete test ↵nobu
committed accidentally. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34412 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-31* io.c (argf_close): skip stdin, which should be readable again.nobu
[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
2011-09-03* io.c (argf_next_argv): open in default text mode.nobu
[ruby-core:39234] [Bug #5268] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33171 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-03* util.c, include/ruby/util.h (ruby_add_suffix): remove the function.usa
[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
2011-01-13* io.c (argf_next_argv): go advance when the next file cannot benobu
read. [ruby-core:34446] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-14* test/ruby/test_argf.rb (test_inplace_rename_impossible): unlinkusa
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
2010-11-14* io.c (argf_readlines): forward to current_file for argumentsnobu
check. http://twitter.com/nagachika/status/3634254856589312 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-11* io.c (rb_io_getline_fast, rb_io_getline_1): fix ARGF.lineno behavior. ↵kazu
[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
2009-09-13remove temporally files explicitly.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24908 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-13make tempfile prefix more descriptive.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e