aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_econv.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-17 04:40:59 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-17 04:40:59 +0000
commit128abaede677c9b5c885a375f4fc19e6a733172e (patch)
tree7244c89a8d0dfd9eb7d0da945728ebba1822c927 /test/ruby/test_econv.rb
parent0051d4a0778d8b81f22cdcac8a6af52fa567d5fe (diff)
downloadruby-128abaede677c9b5c885a375f4fc19e6a733172e.tar.gz
* transcode.c (econv_primitive_putback): new method.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_econv.rb')
-rw-r--r--test/ruby/test_econv.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ruby/test_econv.rb b/test/ruby/test_econv.rb
index 1f15a759a0..9ba5fcab29 100644
--- a/test/ruby/test_econv.rb
+++ b/test/ruby/test_econv.rb
@@ -415,4 +415,16 @@ class TestEncodingConverter < Test::Unit::TestCase
assert_equal("\u{3042}", err.error_char)
end
+ def test_putback
+ ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1")
+ ret = ec.primitive_convert(src="abc\xa1def", dst="", nil, 10)
+ assert_equal(:invalid_byte_sequence, ret)
+ assert_equal(["abc", "ef"], [dst, src])
+ src = ec.primitive_putback(nil) + src
+ assert_equal(["abc", "def"], [dst, src])
+ ret = ec.primitive_convert(src, dst, nil, 10)
+ assert_equal(:finished, ret)
+ assert_equal(["abcdef", ""], [dst, src])
+ end
+
end