[PATCH 1 of 4] tests: make 'f' tool open files in binary mode when hexdumping

Matt Harbison matt_harbison at yahoo.com
Mon Nov 9 22:30:29 UTC 2015


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1447091371 18000
#      Mon Nov 09 12:49:31 2015 -0500
# Node ID 0b2b461f75b2c73adeb0728ed081c0222fc4f52e
# Parent  f9984f76fd90e439221425d751e29bae17bec995
tests: make 'f' tool open files in binary mode when hexdumping

On Windows, the various bundle hexdumps were being truncated at the first
occurrence of 0x1a.  The line endings in the sequence generation then needs to
be standardized on LF so that the file is the same for the tool tests.

diff --git a/tests/f b/tests/f
--- a/tests/f
+++ b/tests/f
@@ -44,7 +44,7 @@
             if opts.type:
                 facts.append('file')
             if opts.hexdump or opts.dump or opts.md5:
-                content = file(f).read()
+                content = file(f, 'rb').read()
         elif islink:
             if opts.type:
                 facts.append('link')
diff --git a/tests/test-tools.t b/tests/test-tools.t
--- a/tests/test-tools.t
+++ b/tests/test-tools.t
@@ -43,7 +43,13 @@
   foo: mode=644
 #endif
 
+#if no-windows
   $ python $TESTDIR/seq.py 10 > bar
+#else
+Convert CRLF -> LF for consistency
+  $ python $TESTDIR/seq.py 10 | sed "s/$//" > bar
+#endif
+
 #if unix-permissions symlink
   $ chmod +x bar
   $ f bar --newer foo --mode --type --size --dump --links --bytes 7


More information about the Mercurial-devel mailing list