Commits

Brodie Rao  committed 3c2cb65

Remove the need for (re) in the diff headers in cram.t

  • Participants
  • Parent commits 68e5ab2

Comments (0)

Files changed (2)

     started = False
     for group in matcher(None, a, b).get_grouped_opcodes(n):
         if not started:
-            fromdate = '\t%s' % fromfiledate or ''
-            todate = '\t%s' % tofiledate or ''
+            fromdate = fromfiledate and '\t%s' % fromfiledate or ''
+            todate = fromfiledate and '\t%s' % tofiledate or ''
             yield '--- %s%s%s' % (fromfile, fromdate, lineterm)
             yield '+++ %s%s%s' % (tofile, todate, lineterm)
             started = True

File tests/cram.t

 
   $ cram examples examples/fail.t examples/.hidden.t
   .s.!
-  \-\-\- .*/examples/fail\.t\s* (re)
-  \+\+\+ .*/examples/fail\.t\.err\s* (re)
+  --- */examples/fail.t (glob)
+  +++ */examples/fail.t.err (glob)
   @@ -3,21 +3,22 @@
      $ echo 1
      1
   examples/empty.t: empty
   examples/env.t: passed
   examples/fail.t: failed
-  \-\-\- .*/examples/fail\.t\s* (re)
-  \+\+\+ .*/examples/fail\.t\.err\s* (re)
+  --- */examples/fail.t (glob)
+  +++ */examples/fail.t.err (glob)
   @@ -3,21 +3,22 @@
      $ echo 1
      1
 
   $ cram -n -i examples/fail.t
   !
-  \-\-\- .*/examples/fail\.t\s* (re)
-  \+\+\+ .*/examples/fail\.t\.err\s* (re)
+  --- */examples/fail.t (glob)
+  +++ */examples/fail.t.err (glob)
   @@ -3,21 +3,22 @@
      $ echo 1
      1
   $ cp examples/fail.t examples/fail.t.orig
   $ cram -y -i examples/fail.t
   !
-  \-\-\- .*/examples/fail\.t\s* (re)
-  \+\+\+ .*/examples/fail\.t\.err\s* (re)
+  --- */examples/fail.t (glob)
+  +++ */examples/fail.t.err (glob)
   @@ -3,21 +3,22 @@
      $ echo 1
      1
 
   $ printf 'bad\nn\n' | cram -v -i examples/fail.t
   examples/fail.t: failed
-  \-\-\- .*/examples/fail\.t\s* (re)
-  \+\+\+ .*/examples/fail\.t\.err\s* (re)
+  --- */examples/fail.t (glob)
+  +++ */examples/fail.t.err (glob)
   @@ -3,21 +3,22 @@
      $ echo 1
      1
   .*\b6aed028cafd917d35ce7db5029e8f559\b.* (re)
   $ printf 'bad\n\n' | cram -v -i examples/fail.t
   examples/fail.t: failed
-  \-\-\- .*/examples/fail\.t\s* (re)
-  \+\+\+ .*/examples/fail\.t\.err\s* (re)
+  --- */examples/fail.t (glob)
+  +++ */examples/fail.t.err (glob)
   @@ -3,21 +3,22 @@
      $ echo 1
      1
   $ cp examples/fail.t examples/fail.t.orig
   $ printf 'bad\ny\n' | cram -v -i examples/fail.t
   examples/fail.t: failed
-  \-\-\- .*/examples/fail\.t\s* (re)
-  \+\+\+ .*/examples/fail\.t\.err\s* (re)
+  --- */examples/fail.t (glob)
+  +++ */examples/fail.t.err (glob)
   @@ -3,21 +3,22 @@
      $ echo 1
      1
   $ echo "  $ echo 1" > fixed.t
   $ cram fixed.t
   !
-  \-\-\- .*/fixed\.t\s* (re)
-  \+\+\+ .*/fixed\.t\.err\s* (re)
+  --- */fixed.t (glob)
+  +++ */fixed.t.err (glob)
   @@ -1,1 +1,2 @@
      $ echo 1
   +  1