diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-17 04:25:56 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-17 04:25:56 +0000 |
commit | 0051d4a0778d8b81f22cdcac8a6af52fa567d5fe (patch) | |
tree | 7f9d2ef862a9b51a90ef035b2998efade8645a7f /test/ruby | |
parent | 04bbc1df1259e70064585dc23bacc7d904063f7e (diff) | |
download | ruby-0051d4a0778d8b81f22cdcac8a6af52fa567d5fe.tar.gz |
* include/ruby/encoding.h (rb_econv_putbackable): declared.
(rb_econv_putback): ditto.
* transcode.c (rb_econv_putbackable): implemented.
(rb_econv_putback): ditto.
* io.c (io_getc): put back bytes if possible.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18670 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_io_m17n.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_io_m17n.rb b/test/ruby/test_io_m17n.rb index 6d7b4f7f9b..6cec7a05bb 100644 --- a/test/ruby/test_io_m17n.rb +++ b/test/ruby/test_io_m17n.rb @@ -216,6 +216,16 @@ EOT } end + def test_getc_invalid + with_pipe("euc-jp:utf-8") {|r, w| + w << "\xa1xyz" + w.close + err = assert_raise(Encoding::InvalidByteSequence) { r.getc } + assert_equal("\xA1".force_encoding("ascii-8bit"), err.error_bytes) + assert_equal("xyz", r.read(10)) + } + end + def test_getc_stateful_conversion with_tmpdir { src = "\e$B\x23\x30\x23\x31\e(B".force_encoding("iso-2022-jp") |