Mercurial > hg
comparison tests/test-fix.t @ 37798:8fa3396a832d stable
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.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Thu, 19 Apr 2018 22:12:10 +0900 |
parents | 72ccb0716302 |
children | 80695628adcb |
comparison
equal
deleted
inserted
replaced
37797:43221a57e22f | 37798:8fa3396a832d |
---|---|
491 $ cd donttouchunfixedfiles | 491 $ cd donttouchunfixedfiles |
492 | 492 |
493 $ printf "NO FIX NEEDED\n" > foo.whole | 493 $ printf "NO FIX NEEDED\n" > foo.whole |
494 $ hg add | 494 $ hg add |
495 adding foo.whole | 495 adding foo.whole |
496 $ cp foo.whole foo.whole.orig | 496 $ cp -p foo.whole foo.whole.orig |
497 $ sleep 2 # mtime has a resolution of one or two seconds. | 497 $ sleep 2 # mtime has a resolution of one or two seconds. |
498 $ hg fix --working-dir | 498 $ hg fix --working-dir |
499 $ f foo.whole --newer foo.whole.orig | 499 $ f foo.whole.orig --newer foo.whole |
500 foo.whole: older than foo.whole.orig | 500 foo.whole.orig: newer than foo.whole |
501 | 501 |
502 $ cd .. | 502 $ cd .. |
503 | 503 |
504 When a fixer prints to stderr, we assume that it has failed. We should show the | 504 When a fixer prints to stderr, we assume that it has failed. We should show the |
505 error messages to the user, and we should not let the failing fixer affect the | 505 error messages to the user, and we should not let the failing fixer affect the |