summaryrefslogtreecommitdiff
path: root/test/ruby/test_io_m17n.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-17 19:41:39 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-17 19:41:39 +0000
commitf3a42261fb1e325ab8fde99adcc4722cbb110a18 (patch)
tree3548bb99192a5f6ff977a66a06a02aaadc6c56be /test/ruby/test_io_m17n.rb
parent0b52b491477f9bfc8aeb38612c27d7caca3385ef (diff)
* io.c (appendline): appendline cannot check character boundary.
(rb_io_getline_1): relax limit until character boundary. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_io_m17n.rb')
-rw-r--r--test/ruby/test_io_m17n.rb16
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")