diff options
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_io_m17n.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/ruby/test_io_m17n.rb b/test/ruby/test_io_m17n.rb index 6cec7a05bb..14d29282a2 100644 --- a/test/ruby/test_io_m17n.rb +++ b/test/ruby/test_io_m17n.rb @@ -445,6 +445,22 @@ EOT } end + def test_gets_limit + with_pipe("euc-jp") {|r, w| w << "\xa4\xa2\xa4\xa4\xa4\xa6\xa4\xa8\xa4\xaa"; w.close + assert_equal("\xa4\xa2".force_encoding("euc-jp"), r.gets(1)) + } + with_pipe("euc-jp") {|r, w| w << "\xa4\xa2\xa4\xa4\xa4\xa6\xa4\xa8\xa4\xaa"; w.close + assert_equal("\xa4\xa2".force_encoding("euc-jp"), r.gets(2)) + } + with_pipe("euc-jp") {|r, w| w << "\xa4\xa2\xa4\xa4\xa4\xa6\xa4\xa8\xa4\xaa"; w.close + assert_equal("\xa4\xa2\xa4\xa4".force_encoding("euc-jp"), r.gets(3)) + } + with_pipe("euc-jp") {|r, w| w << "\xa4\xa2\xa4\xa4\xa4\xa6\xa4\xa8\xa4\xaa"; w.close + assert_equal("\xa4\xa2\xa4\xa4".force_encoding("euc-jp"), r.gets(4)) + } + + end + def test_file_foreach with_tmpdir { generate_file('tst', 'a' * 8191 + "\xa1\xa1") |