diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-05-21 14:48:03 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-05-21 14:48:03 +0000 |
commit | ce1a4ee112f3796381cc7fc24ac4e7d145f9409a (patch) | |
tree | ca483353f39cdfec237c3d811f57f8f37f593c1e /test/stringio/test_stringio.rb | |
parent | 6fac4c5f9f994a0eb95281e79b27a01bc4e6bf29 (diff) |
merges r23424 from trunk into ruby_1_9_1.
--
* ext/stringio/stringio.c (strio_ungetbyte): encoding should not
be effective.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@23520 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/stringio/test_stringio.rb')
-rw-r--r-- | test/stringio/test_stringio.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/stringio/test_stringio.rb b/test/stringio/test_stringio.rb index 98cf84e00f..4d1fdf28d1 100644 --- a/test/stringio/test_stringio.rb +++ b/test/stringio/test_stringio.rb @@ -293,6 +293,21 @@ class TestStringIO < Test::Unit::TestCase f.close unless f.closed? end + def test_ungetbyte + s = "foo\nbar\n" + t = StringIO.new(s, "r") + t.ungetbyte(0x41) + assert_equal(0x41, t.getbyte) + t.ungetbyte("qux") + assert_equal("quxfoo\n", t.gets) + t.set_encoding("utf-8") + t.ungetbyte(0x89) + t.ungetbyte(0x8e) + t.ungetbyte("\xe7") + t.ungetbyte("\xe7\xb4\x85") + assert_equal("\u7d05\u7389bar\n", t.gets) + end + def test_ungetc s = "1234" f = StringIO.new(s, "r") |