Skip to content

Commit

Permalink
os: make os_stat_test.v more robust to reporting false positives
Browse files Browse the repository at this point in the history
  • Loading branch information
spytheman committed Feb 8, 2024
1 parent a9ebab0 commit a4d0d4e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion vlib/os/os_stat_test.v
Expand Up @@ -3,7 +3,7 @@ import rand
import time

fn test_stat() {
start_time := time.utc()
start_time := time.utc().add(-2 * time.second)

temp_dir := os.join_path(os.temp_dir(), rand.ulid())
os.mkdir(temp_dir)!
Expand All @@ -21,6 +21,8 @@ fn test_stat() {
end_time := time.utc()

mut fstat := os.stat(test_file)!
eprintln(@LOCATION)
eprintln(' | start_time: ${start_time.unix}\n | end_time: ${end_time.unix}\n | fstat.ctime: ${fstat.ctime}\n | fstat.mtime: ${fstat.mtime}')
assert fstat.get_filetype() == .regular
assert fstat.size == u64(test_content.len)
assert fstat.ctime >= start_time.unix
Expand Down

0 comments on commit a4d0d4e

Please sign in to comment.