aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_io_m17n.rb
Commit message (Collapse)AuthorAgeFilesLines
* * test/ruby/test_io_m17n.rb (test_each_codepoint_need_more): Bumpheadius2016-03-031-1/+1
| | | | | | timeout up to 10s for slower platforms and impls. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_io_m17n.rb: BOM with non-UTFnobu2016-01-211-0/+13
| | | | | | | * test/ruby/test_io_m17n.rb (test_bom_non_utf): assert BOM with non-UTF encoding in encoding option, for r53084. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53604 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
* test: use String#b instead of dup.force_encodingnobu2015-12-141-3/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io.c: encoding in warningsnobu2015-12-131-0/+8
| | | | | | | * io.c (parse_mode_enc): preserve encoding of mode string in warnings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io.c: BOM with non-UTFnobu2015-12-131-0/+14
| | | | | | | | * io.c (io_encname_bom_p): check BOM prefix only, not including UTF prefix. * io.c (parse_mode_enc): warn BOM with non-UTF encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53084 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io.c: fix stack smashingnobu2015-12-131-0/+13
| | | | | | * io.c (parse_mode_enc): fix buffer overflow. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io.c: raise at incomplete charnobu2015-08-171-16/+35
| | | | | | | * io.c (rb_io_each_codepoint): raise an exception at incomplete character before EOF when conversion takes place. [Bug #11444] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io.c: read more datanobu2015-08-151-0/+20
| | | | | | | * io.c (rb_io_each_codepoint): read more data when read partially. [ruby-core:70379] [Bug #11444] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* use Timeout.timeoutnobu2015-07-131-1/+1
| | | | | | | * time: Object#timeout has been deprecated a long time ago, use Timeout.timeout. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_io.rb: skip method definitionsnobu2015-06-301-2/+1
| | | | | | | * test/ruby/{test_io,test_io_m17n}.rb: skip method definitions on unsupported platforms. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51068 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_io_m17n.rb: Add test for coderange clearing inheadius2014-12-151-0/+16
| | | | | | IO#read with buffer. See jruby/jruby#2316. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48847 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
* test_io_m17n.rb: leaked FDsnobu2014-08-281-2/+2
| | | | | | | * test/ruby/test_io_m17n.rb (test_ignored_encoding_option): fix leaked file descriptors by r47305. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io.c: preserve encodingsnobu2014-08-281-0/+11
| | | | | | | * io.c (rb_io_extract_encoding_option): preserve encodings in warning messages. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47305 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_io_s_pipe): Close pipes if io_encoding_set() raises anakr2014-05-291-22/+24
| | | | | | | | | exception. (io_encoding_set_v): New function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/ruby: better assertionsnobu2013-12-131-1/+1
| | | | | | * test/ruby: use better assertions instead of mere assert. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44173 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/unit/assertions.rb: return exceptionnobu2013-10-091-4/+6
| | | | | | | | | * lib/test/unit/assertions.rb (assert_raise_with_message): return raised exception same as assert_raise. * test/ruby, test/-ext-: use assert_raise_with_message. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io.c: fix 7bit coderange conditionnobu2013-06-121-1/+11
| | | | | | | * io.c (io_getc): fix 7bit coderange condition, check if ascii read data instead of read length. [ruby-core:55444] [Bug #8516] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41250 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_io_ext_int_to_encs): ignore internal encoding if externalnaruse2013-05-081-0/+36
| | | | | | encoding is ASCII-8BIT. [Bug #8342] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40610 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io.c: conversion from bom encodingnobu2013-04-251-1/+23
| | | | | | | | | | | | * io.c (rb_io_ext_int_to_encs, parse_mode_enc): bom-prefixed name is not a real encoding name, just a fallback. so the proper conversion should take place even if if the internal encoding is equal to the bom-prefixed name, unless actual encoding is equal to the internal encoding. [ruby-core:54563] [Bug #8323] * io.c (io_set_encoding_by_bom): reset extenal encoding if no BOM found. [ruby-core:54569] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40462 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/envutil.rb (EnvUtil.with_default_external): add fornaruse2013-03-111-20/+18
| | | | | | | | | | changing Encoding.default_external without warnings. * test/ruby/envutil.rb (EnvUtil.with_default_internal): ditto. * test/ruby/test_io_m17n.rb: use above with_default_external. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39721 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (extract_binmode): raise error even if binmode and textmodenaruse2013-03-111-3/+6
| | | | | | don't conflict. [Bug #5918] [ruby-core:42199] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39720 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix tests of rb_warning().knu2012-11-241-6/+6
| | | | | | | | | | * test/ruby/envutil.rb (Test::Unit::Assertions#assert_warning) (Test::Unit::Assertions#assert_warn), test/ruby/envutil.rb, test/ruby/test_enumerator.rb, test/ruby/test_io_m17n.rb, test/ruby/test_regexp.rb, test/ruby/test_syntax.rb: assert_warn() and assert_warning() are reversed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ruby.c (load_file_internal): set default source encoding asnaruse2012-11-061-0/+1
| | | | | | | | | UTF-8 instead of US-ASCII. [ruby-core:46021] [Feature #6679] * parse.y (parser_initialize): set default parser encoding as UTF-8 instead of US-ASCII. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37485 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (io_unread): fix IO#pos with mode 'r' bug on Windows.shirosaki2012-05-081-0/+16
| | | | | | | | | | | If the end of reading buffer is CR, io_unread() needs to unread one more byte. [ruby-core:44874] [Bug #6401] * test/ruby/test_io_m17n.rb (TestIO_M17N#test_pos_with_buffer_end_cr): add a test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* use assert_equal, assert_match, and so on.nobu2012-05-071-1/+1
| | | | | | | | | | | | * test/fileutils/fileasserts.rb: use assert_equal, assert_match, and so on. * test/ruby/enc/test_utf16.rb, test/ruby/enc/test_utf32.rb, test/ruby/test_io_m17n.rb (assert_str_equal): ditto. * test/rubygems/test_gem_remote_fetcher.rb (assert_data_from_{server,proxy}): ditto. * test/test_pstore.rb (test_thread_safe): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35553 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (parse_mode_enc): remove warnings 'Ignoring internal encoding'.naruse2012-05-041-7/+8
| | | | | | | | [ruby-core:44455] [Bug #6324] * io.c (io_encoding_set): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35538 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_io_eof): use eof() instead of io_fillbuf(). It's becauseshirosaki2012-04-111-0/+16
| | | | | | | | | | | io_unread() doesn't work properly when reading CRLF with read(length) and mode 'r'. [ruby-core:44189][Bug #6271] * test/ruby/test_io_m17n.rb (TestIO_M17N#test_read_crlf_and_eof): test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35296 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (static int io_fflush): add the definition.shirosaki2012-03-221-0/+15
| | | | | | | | | | | | | | | | | | Use it in set_binary_mode_with_seek_cur(). * io.c (set_binary_mode_with_seek_cur): refactoring to split the content into io_unread(). Fix the possibility of buffer overflow. * io.c (io_unread): add new implementation for Windows. Previous one caused invalid cursor position using IO#pos with OS text mode. New one fixes the bug. * test/ruby/test_io_m17n.rb (TestIO_M17N#test_pos_dont_move_cursor_position): add a test for above bug. [ruby-core:43497] [Bug #6179] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35111 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (io_encoding_set): always warn if external encoding and internalnaruse2012-03-131-0/+26
| | | | | | encoding are identical. [ruby-core:40727] [Bug #5568] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34997 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* assert_warn, assert_warningnobu2012-03-131-12/+0
| | | | | | | | * test/ruby/envutil.rb (assert_warn): add optional message argument. * test/ruby/envutil.rb (assert_warning): moved from test_io_m17n.rb git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34994 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Add missing assert_warning.naruse2012-03-121-3/+15
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_find_encoding): new function find encoding fromnobu2012-03-121-0/+11
| | | | | | | | | | arbitrary object as a pointer to rb_encoding, and return NULL if not found. * io.c (io_encoding_set): just warn unsupported encodings, but not exception. [ruby-core:40726] [Bug #5567] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * dir.c (dir_inspect), io.c (rb_io_inspect): keep encoding of path.nobu2012-02-241-0/+11
| | | | | | | [Bug #6072] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * dir.c (dir_initialize): keep path in original encoding.nobu2012-02-241-0/+11
| | | | | | | | * error.c (syserr_initialize): prefer the encoding of message over locale. [ruby-dev:45279][Bug #6071] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Additional test for r34358.naruse2012-01-241-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34366 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (extract_binmode): raise an exception if binmode/textmodenaruse2012-01-231-0/+25
| | | | | | | is specified with both vmode and opthash. [ruby-core:42199] [Bug #5918] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_io_extract_modeenc): set ASCII-8BIT if binmode is specifiednaruse2012-01-231-0/+5
| | | | | | with opthash. [ruby-core:42197] [Bug #5917] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_sys_fail_path): move the definition.shirosaki2011-12-261-0/+11
| | | | | | | | | | | | | | | | | | | | | Move above for using it in set_binary_mode_with_seek_cur(). * io.c (set_binary_mode_with_seek_cur): fix improper seek cursor. Seeking file cursor with setting binary mode has possibility to cause infinite loop. Fixed the bug and refined error handling. Introduced at r34043. And cleanups as below. Remove unnecessary parentheses of `fptr`. Use return value of setmode(). * test/ruby/test_io_m17n.rb (TestIO_M17N#test_seek_with_setting_binmode): add a test for abobe. [ruby-core:41671] [Bug #5714] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34132 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_io_m17n.rbusa2011-12-141-2/+2
| | | | | | | (TestIO_M17N#test_{read_with_binmode_and_get[cs]}): only for Windows. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34045 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * win32/win32.c, include/ruby/win32.h (rb_w32_fd_is_text): new function.usa2011-12-141-0/+92
| | | | | | | | | | | | | | | | | | | | | | | | | * win32/win32.c (init_stdhandle): set default mode of stdin as binmode. * io.c (set_binary_mode_with_seek_cur): new function to replace SET_BINARY_MODE_WITH_SEEK_CUR macro. now returns previous mode of the fd and take care of LF in rbuf. * io.c (do_writeconv): set text mode when needed. * io.c (io_read): need to change the mode of the IO to binmode temporally when the length for IO#read, because IO#read with length must behave so. * test/ruby/test_io_m17n.rb (TestIO_M17N#est_{read_with_length, read_with_length_binmode,get[cs]_and_read_with_binmode, read_with_binmode_and_get[cs],read_write_with_binmode}): tests for above changes. all patches are written by Hiroshi Shirosaki. [ruby-core:41496] [Feature #5714] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Introduce NEED_READCONV and NEED_WRITECONV to replace universal newline ↵luislavena2011-12-041-0/+48
| | | | | | | | | decorator Use CRLF only when required to improve file reading and writing under Windows. Patch by Hiroshi Shirosaki. [ruby-core:40706] [Feature #5562] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33937 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/encoding.h (ECONV_NEWLINE_DECORATOR_READ_MASK,usa2011-11-071-0/+57
| | | | | | | | | | | | | | | | | | | | | | ECONV_NEWLINE_DECORATOR_WRITE_MASK): new macro. * io.c (rb_io_extract_modeenc, pipe_open, prep_stdio, argf_next_argv): set TEXTMODE_NEWLINE_DECORATOR_ON_WRITE for textmode on creating IO if the flag is available. * io.c (make_writeconv): drop decorators for reading. * io.c (make_readconv): drop decorators for writing. * io.c (do_writeconv): existing writeconv is not the condition to raise ArgumentError. should check textmode or not. * test/ruby/test_io_m17n.rb (TestIO_M17N#test_{cr,lf,crlf}_decorator_on_stdout): test above changes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_io_m17n.rbusa2011-11-071-0/+20
| | | | | | | | (TestIO_M17N#test_default_stdout_stderr_mode): new test for r33627-33629. see [backport #5565] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33649 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_io_m17n.rb (TestIO_M17N#test_{default_mode_on_dosish,usa2011-09-011-6/+6
| | | | | | | | | default_mode_on_unix,text_mode,binary_mode}): sorry for wrong test committed in r33144. I'd misunderstood the spec of ruby's universal newline. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_io_m17n.rb (TestIO_M17N#test_{default_mode_on_dosish,usa2011-08-311-1/+28
| | | | | | | default_mode_on_unix,text_mode,binary_mode}): tests for [Bug # 5164]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33144 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (io_getc): should be 7bit if ascii. fixes #4557nobu2011-06-111-0/+9
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32000 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (validate_enc_binmode, rb_io_extract_modeenc): set newlinenobu2011-04-261-0/+3
| | | | | | | | decorator according to open mode. * transcode.c (rb_econv_prepare_options): new function, to prepare econv options with newline flags. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_io_m17n.rb (test_io_new_enc): "sjis" is now an aliasnagachika2011-03-091-1/+1
| | | | | | of Windows-31J. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31078 b2dd03c8-39d4-4d8f-98ff-823fe69b080e