From 08759d1f0abcd9829becff4178858ffd5dbc6c71 Mon Sep 17 00:00:00 2001 From: shyouhei Date: Wed, 25 Nov 2009 08:45:13 +0000 Subject: merge revision(s) 25485: * io.c (io_fwrite): adjust stdio file position after direct write on BSDish platforms. [ruby-core:26300] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@25918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_io.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test') diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index b5e9b8ec06..ce1d4c6668 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -45,4 +45,19 @@ class TestIO < Test::Unit::TestCase t.close assert_raise(IOError) {t.binmode} end + + def test_pos + t = make_tempfile + + open(t.path, IO::RDWR|IO::CREAT|IO::TRUNC, 0600) do |f| + f.write "Hello" + assert_equal(5, f.pos) + end + open(t.path, IO::RDWR|IO::CREAT|IO::TRUNC, 0600) do |f| + f.sync = true + f.read + f.write "Hello" + assert_equal(5, f.pos) + end + end end -- cgit v1.2.3