From b4f0a68fba4b222461ca79feb94d94e325341129 Mon Sep 17 00:00:00 2001 From: Tomoyuki Sahara Date: Mon, 30 Sep 2013 10:17:21 +0900 Subject: add File#flock. --- test/file.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/file.rb') diff --git a/test/file.rb b/test/file.rb index 8fe7636e0..4b3458d1a 100644 --- a/test/file.rb +++ b/test/file.rb @@ -49,6 +49,17 @@ assert('File.extname') do assert_equal '', File.extname('.foo') end +assert('IO#flock') do + f = File.open $mrbtest_io_rfname + assert_equal(f.flock(File::LOCK_SH), 0) + assert_equal(f.flock(File::LOCK_UN), 0) + assert_equal(f.flock(File::LOCK_EX | File::LOCK_UN), 0) + assert_equal(f.flock(File::LOCK_UN), 0) + f.close + true +end + + assert('File.size') do File.size($mrbtest_io_rfname) == $mrbtest_io_msg.size + 1 and File.size($mrbtest_io_wfname) == 0 -- cgit v1.2.3