From b0af034e5333381f154747e5bbc7c12feb9495ad Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 26 Oct 2009 03:06:29 +0000 Subject: * io.c (io_fwrite): adjust stdio file position after direct write on BSDish platforms. [ruby-core:26300] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@25485 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_io.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index 71f31e37a..0052a9263 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -1167,6 +1167,21 @@ class TestIO < Test::Unit::TestCase end 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 + def test_sysseek t = make_tempfile -- cgit