diff options
| author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-10-26 03:06:29 +0000 |
|---|---|---|
| committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-10-26 03:06:29 +0000 |
| commit | ce4e9dff9b79af947bb19bbe96c4b842bffd4611 (patch) | |
| tree | aeabf156cee13595eccb86091f31f6fa1eb29e8d /test | |
| parent | bc078709a5effaee9dfc6a0e50a2c16a457d48d4 (diff) | |
* 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@25485 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
| -rw-r--r-- | test/ruby/test_io.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index 7137b5f772..feab552582 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -34,4 +34,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 |
