summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorTomoyuki Sahara <[email protected]>2013-09-30 10:17:21 +0900
committerTomoyuki Sahara <[email protected]>2013-09-30 10:17:21 +0900
commitb4f0a68fba4b222461ca79feb94d94e325341129 (patch)
treef63fc3799c9605a15f20168148f50fdec82beb9a /test
parent140da1c6caf1ba98f961470a1d87ba7e14f0fb25 (diff)
downloadmruby-b4f0a68fba4b222461ca79feb94d94e325341129.tar.gz
mruby-b4f0a68fba4b222461ca79feb94d94e325341129.zip
add File#flock.
Diffstat (limited to 'test')
-rw-r--r--test/file.rb11
1 files changed, 11 insertions, 0 deletions
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