test-fix: fix use of 'f --newer' to check that foo.whole is not updated stable
authorYuya Nishihara <yuya@tcha.org>
Thu, 19 Apr 2018 22:12:10 +0900
branchstable
changeset 37798 8fa3396a832d
parent 37797 43221a57e22f
child 37799 1770d8b3e554
test-fix: fix use of 'f --newer' to check that foo.whole is not updated Here we want to assert not 'mtime(foo.whole.orig) < mtime(foo.whole)'. The condition has to be inverted since 'f --newer' says "newer" if the mtimes match. Alternatively, we could insert 'sleep 2' before 'cp' to ensure that foo.whole.orig is newer than foo.whole, but a fewer sleeps should be better.
tests/test-fix.t
--- a/tests/test-fix.t	Thu Apr 19 19:55:51 2018 +0900
+++ b/tests/test-fix.t	Thu Apr 19 22:12:10 2018 +0900
@@ -493,11 +493,11 @@
   $ printf "NO FIX NEEDED\n" > foo.whole
   $ hg add
   adding foo.whole
-  $ cp foo.whole foo.whole.orig
+  $ cp -p foo.whole foo.whole.orig
   $ sleep 2 # mtime has a resolution of one or two seconds.
   $ hg fix --working-dir
-  $ f foo.whole --newer foo.whole.orig
-  foo.whole: older than foo.whole.orig
+  $ f foo.whole.orig --newer foo.whole
+  foo.whole.orig: newer than foo.whole
 
   $ cd ..