summaryrefslogtreecommitdiffstats
path: root/test/ruby
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-05-21 14:48:03 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-05-21 14:48:03 +0000
commitf3df595bee7a5495bcc3a719fd417260e883937f (patch)
treeca483353f39cdfec237c3d811f57f8f37f593c1e /test/ruby
parentcb1f9532b7440d08cf0fc31edccb3605e8f455f1 (diff)
merges r23424 from trunk into ruby_1_9_1.
-- * ext/stringio/stringio.c (strio_ungetbyte): encoding should not be effective. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@23520 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_io.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
index 9082b76b6..776cf3414 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -77,6 +77,22 @@ class TestIO < Test::Unit::TestCase
r.close
end
+ def test_ungetbyte
+ t = make_tempfile
+ t.open
+ t.ungetbyte(0x41)
+ assert_equal(0x41, t.getbyte)
+ t.rewind
+ 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_each_byte
r, w = IO.pipe
w << "abc def"