[PATCH] diffstat: made test case work with POSIX sh and printf

Yuya Nishihara yuya at tcha.org
Tue Oct 27 08:03:16 CDT 2009


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1256648384 -32400
# Node ID bd3af545c7c6f7fb66c9377259316220d329282d
# Parent  1ad02c04356cd85a84d8f401ecd37fde75ddd75c
diffstat: made test case work with POSIX sh and printf

* arithmetic expression ((...)), without $, is bashism.
* printf '\xXX' seems non-standard. '\0' is okay.
  http://www.opengroup.org/onlinepubs/009695399/utilities/printf.html

tested with bash 4.0 and dash 0.5.5.1

diff --git a/tests/test-diffstat b/tests/test-diffstat
--- a/tests/test-diffstat
+++ b/tests/test-diffstat
@@ -2,7 +2,7 @@
 
 hg init repo
 cd repo
-i=0; while (( $i < 213 )); do echo a >> a; i=$(($i + 1)); done
+i=0; while [ "$i" -lt 213 ]; do echo a >> a; i=$(($i + 1)); done
 hg add a
 
 echo '% wide diffstat'
@@ -24,7 +24,7 @@ hg diff --stat
 
 hg ci -m appenda
 
-printf '%b' '\x00' > b
+printf '\0' > b
 hg add b
 
 echo '% binary diffstat'


More information about the Mercurial-devel mailing list