diff options
| author | Yasuhiro Matsumoto <[email protected]> | 2018-01-30 16:02:00 +0900 |
|---|---|---|
| committer | Yasuhiro Matsumoto <[email protected]> | 2018-01-30 16:02:00 +0900 |
| commit | f4f006ba406b96f077c976d8839ec02065da1610 (patch) | |
| tree | 00b33e7d91dc637faddd5ac973dfb67350a22c94 /mrbgems/mruby-io/test | |
| parent | 83f2654bac329e9533c893e3759ae045e57b625a (diff) | |
| download | mruby-f4f006ba406b96f077c976d8839ec02065da1610.tar.gz mruby-f4f006ba406b96f077c976d8839ec02065da1610.zip | |
add File#mtime
Diffstat (limited to 'mrbgems/mruby-io/test')
| -rw-r--r-- | mrbgems/mruby-io/test/file.rb | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/mrbgems/mruby-io/test/file.rb b/mrbgems/mruby-io/test/file.rb index e5c127746..dc6fe369a 100644 --- a/mrbgems/mruby-io/test/file.rb +++ b/mrbgems/mruby-io/test/file.rb @@ -54,7 +54,7 @@ assert('File.extname') do assert_equal '', File.extname('.foo') end -assert('IO#flock') do +assert('File#flock') do f = File.open $mrbtest_io_rfname begin assert_equal(f.flock(File::LOCK_SH), 0) @@ -68,6 +68,22 @@ assert('IO#flock') do end end +assert('File#mtime') do + unless Object.const_defined?(:Time) + skip "File#mtime require Time" + end + begin + now = Time.now.to_i + mt = 0 + File.open('mtime-test', 'w') do |f| + mt = f.mtime.to_i + end + assert_equal true, mt >= now + ensure + File.delete('mtime-test') + end +end + assert('File.join') do assert_equal "", File.join() assert_equal "a", File.join("a") |
