summaryrefslogtreecommitdiff
path: root/test/ruby/test_io_m17n.rb
AgeCommit message (Collapse)Author
2016-01-21test_io_m17n.rb: BOM with non-UTFnobu
* 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
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-12-14test: use String#b instead of dup.force_encodingnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-13io.c: encoding in warningsnobu
* 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
2015-12-13io.c: BOM with non-UTFnobu
* 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
2015-12-13io.c: fix stack smashingnobu
* 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
2015-08-17io.c: raise at incomplete charnobu
* 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
2015-08-15io.c: read more datanobu
* 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
2015-07-13use Timeout.timeoutnobu
* 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
2015-06-30test_io.rb: skip method definitionsnobu
* 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
2014-12-15* test/ruby/test_io_m17n.rb: Add test for coderange clearing inheadius
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
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-28test_io_m17n.rb: leaked FDsnobu
* 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
2014-08-28io.c: preserve encodingsnobu
* 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
2014-05-29* io.c (rb_io_s_pipe): Close pipes if io_encoding_set() raises anakr
exception. (io_encoding_set_v): New function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-13test/ruby: better assertionsnobu
* 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
2013-10-09test/unit/assertions.rb: return exceptionnobu
* 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
2013-06-12io.c: fix 7bit coderange conditionnobu
* 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
2013-05-08* io.c (rb_io_ext_int_to_encs): ignore internal encoding if externalnaruse
encoding is ASCII-8BIT. [Bug #8342] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40610 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-25io.c: conversion from bom encodingnobu
* 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
2013-03-11* test/ruby/envutil.rb (EnvUtil.with_default_external): add fornaruse
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
2013-03-11* io.c (extract_binmode): raise error even if binmode and textmodenaruse
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
2012-11-24Fix tests of rb_warning().knu
* 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
2012-11-06* ruby.c (load_file_internal): set default source encoding asnaruse
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
2012-05-08* io.c (io_unread): fix IO#pos with mode 'r' bug on Windows.shirosaki
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
2012-05-07use assert_equal, assert_match, and so on.nobu
* 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
2012-05-04* io.c (parse_mode_enc): remove warnings 'Ignoring internal encoding'.naruse
[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
2012-04-11* io.c (rb_io_eof): use eof() instead of io_fillbuf(). It's becauseshirosaki
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
2012-03-22* io.c (static int io_fflush): add the definition.shirosaki
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
2012-03-13* io.c (io_encoding_set): always warn if external encoding and internalnaruse
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
2012-03-13assert_warn, assert_warningnobu
* 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
2012-03-12Add missing assert_warning.naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-12* encoding.c (rb_find_encoding): new function find encoding fromnobu
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
2012-02-24* dir.c (dir_inspect), io.c (rb_io_inspect): keep encoding of path.nobu
[Bug #6072] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-24* dir.c (dir_initialize): keep path in original encoding.nobu
* 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
2012-01-24Additional test for r34358.naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34366 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-23* io.c (extract_binmode): raise an exception if binmode/textmodenaruse
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
2012-01-23* io.c (rb_io_extract_modeenc): set ASCII-8BIT if binmode is specifiednaruse
with opthash. [ruby-core:42197] [Bug #5917] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-26* io.c (rb_sys_fail_path): move the definition.shirosaki
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
2011-12-14* test/ruby/test_io_m17n.rbusa
(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
2011-12-14* win32/win32.c, include/ruby/win32.h (rb_w32_fd_is_text): new function.usa
* 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
2011-12-04Introduce NEED_READCONV and NEED_WRITECONV to replace universal newline ↵luislavena
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
2011-11-07* include/ruby/encoding.h (ECONV_NEWLINE_DECORATOR_READ_MASK,usa
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
2011-11-07* test/ruby/test_io_m17n.rbusa
(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
2011-09-01* test/ruby/test_io_m17n.rb (TestIO_M17N#test_{default_mode_on_dosish,usa
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
2011-08-31* test/ruby/test_io_m17n.rb (TestIO_M17N#test_{default_mode_on_dosish,usa
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
2011-06-11* io.c (io_getc): should be 7bit if ascii. fixes #4557nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32000 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-26* io.c (validate_enc_binmode, rb_io_extract_modeenc): set newlinenobu
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
2011-03-09 * test/ruby/test_io_m17n.rb (test_io_new_enc): "sjis" is now an aliasnagachika
of Windows-31J. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31078 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-11* test/ruby: uniquify test names.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30837 b2dd03c8-39d4-4d8f-98ff-823fe69b080e