mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/fileutils/fileasserts.rb (assert_equal_time): show nsec if
assertion fails but time.to_s equals. (assert_same_entry): use assert_equal_time. * test/fileutils/test_fileutils.rb (test_install): use assert_equal_time. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13973 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
18b46e0c21
commit
b4a0020707
3 changed files with 27 additions and 2 deletions
|
@ -1,3 +1,12 @@
|
|||
Tue Nov 20 00:52:46 2007 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* test/fileutils/fileasserts.rb (assert_equal_time): show nsec if
|
||||
assertion fails but time.to_s equals.
|
||||
(assert_same_entry): use assert_equal_time.
|
||||
|
||||
* test/fileutils/test_fileutils.rb (test_install): use
|
||||
assert_equal_time.
|
||||
|
||||
Mon Nov 19 18:46:49 2007 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* file.c (utime_internal): fallback utimensat to utimes.
|
||||
|
|
|
@ -17,7 +17,7 @@ module Test
|
|||
b = File.stat(to)
|
||||
assert_equal a.mode, b.mode, "mode #{a.mode} != #{b.mode}"
|
||||
#assert_equal a.atime, b.atime
|
||||
assert_equal a.mtime, b.mtime, "mtime #{a.mtime} != #{b.mtime}"
|
||||
assert_equal_time a.mtime, b.mtime, "mtime #{a.mtime} != #{b.mtime}"
|
||||
assert_equal a.uid, b.uid, "uid #{a.uid} != #{b.uid}"
|
||||
assert_equal a.gid, b.gid, "gid #{a.gid} != #{b.gid}"
|
||||
end
|
||||
|
@ -62,6 +62,22 @@ module Test
|
|||
}
|
||||
end
|
||||
|
||||
def assert_equal_time(expected, actual, message=nil)
|
||||
_wrap_assertion {
|
||||
expected_str = expected.to_s
|
||||
actual_str = actual.to_s
|
||||
if expected_str == actual_str
|
||||
expected_str << " (nsec=#{expected.nsec})"
|
||||
actual_str << " (nsec=#{actual.nsec})"
|
||||
end
|
||||
full_message = build_message(message, <<EOT, expected_str, actual_str)
|
||||
<?> expected but was
|
||||
<?>.
|
||||
EOT
|
||||
assert_block(full_message) { expected == actual }
|
||||
}
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -789,7 +789,7 @@ end
|
|||
install 'tmp/aaa', 'tmp/bbb'
|
||||
assert_equal "aaa\n", File.read('tmp/bbb')
|
||||
assert_equal 0600, (File.stat('tmp/bbb').mode & 0777) if have_file_perm?
|
||||
assert_equal t, File.mtime('tmp/bbb')
|
||||
assert_equal_time t, File.mtime('tmp/bbb')
|
||||
|
||||
File.unlink 'tmp/aaa'
|
||||
File.unlink 'tmp/bbb'
|
||||
|
|
Loading…
Add table
Reference in a new issue