* test/fileutils/fileasserts.rb (assert_equal_timestamp): new assert
to test tv_sec only for filestamp resolution portability. (assert_same_entry): use assert_same_entry for mtime comparison. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13992 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
53b3bf961c
commit
a5c4480732
@ -1,3 +1,9 @@
|
||||
Wed Nov 21 16:39:21 2007 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* test/fileutils/fileasserts.rb (assert_equal_timestamp): new assert
|
||||
to test tv_sec only for filestamp resolution portability.
|
||||
(assert_same_entry): use assert_same_entry for mtime comparison.
|
||||
|
||||
Wed Nov 21 14:55:13 2007 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* array.c (rb_ary_permutation): add gc guard codes.
|
||||
|
@ -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_time a.mtime, b.mtime, "mtime #{a.mtime} != #{b.mtime}"
|
||||
assert_equal_timestamp 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
|
||||
@ -78,6 +78,23 @@ EOT
|
||||
}
|
||||
end
|
||||
|
||||
def assert_equal_timestamp(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}> expected but was
|
||||
<#{actual_str}>.
|
||||
EOT
|
||||
# subsecond timestamp is not portable.
|
||||
assert_block(full_message) { expected.tv_sec == actual.tv_sec }
|
||||
}
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user