@@ -509,6 +509,84 @@ def test_git_patch(self):
509
509
510
510
self .assertEqual (results , expected )
511
511
512
+ def test_git_oneline_add (self ):
513
+ with open ('tests/casefiles/git-oneline-add.diff' ) as f :
514
+ text = f .read ()
515
+
516
+ lines = text .splitlines ()
517
+
518
+ expected = [
519
+ wtp .patch .diffobj (
520
+ header = wtp .patch .header (
521
+ index_path = None ,
522
+ old_path = '/dev/null' ,
523
+ old_version = '0000000' ,
524
+ new_path = 'oneline.txt' ,
525
+ new_version = 'f56f98d'
526
+ ),
527
+ changes = [
528
+ (None , 1 , 'Adding a one-line file.' )
529
+ ],
530
+ text = '\n ' .join (lines [:34 ]) + '\n '
531
+ )
532
+ ]
533
+
534
+ results = list (wtp .parse_patch (text ))
535
+
536
+ self .assertEqual (results , expected )
537
+
538
+ def test_git_oneline_change (self ):
539
+ with open ('tests/casefiles/git-oneline-change.diff' ) as f :
540
+ text = f .read ()
541
+
542
+ lines = text .splitlines ()
543
+
544
+ expected = [
545
+ wtp .patch .diffobj (
546
+ header = wtp .patch .header (
547
+ index_path = None ,
548
+ old_path = 'oneline.txt' ,
549
+ old_version = 'f56f98d' ,
550
+ new_path = 'oneline.txt' ,
551
+ new_version = '169ceeb'
552
+ ),
553
+ changes = [
554
+ (1 , None , 'Adding a one-line file.' ),
555
+ (None , 1 , 'Changed a one-line file.' )
556
+ ],
557
+ text = '\n ' .join (lines [:34 ]) + '\n '
558
+ )
559
+ ]
560
+
561
+ results = list (wtp .parse_patch (text ))
562
+ print results
563
+ self .assertEqual (results , expected )
564
+
565
+ def test_git_oneline_rm (self ):
566
+ with open ('tests/casefiles/git-oneline-rm.diff' ) as f :
567
+ text = f .read ()
568
+
569
+ lines = text .splitlines ()
570
+
571
+ expected = [
572
+ wtp .patch .diffobj (
573
+ header = wtp .patch .header (
574
+ index_path = None ,
575
+ old_path = 'oneline.txt' ,
576
+ old_version = '169ceeb' ,
577
+ new_path = '/dev/null' ,
578
+ new_version = '0000000'
579
+ ),
580
+ changes = [
581
+ (1 , None , 'Changed a one-line file.' )
582
+ ],
583
+ text = '\n ' .join (lines [:34 ]) + '\n '
584
+ )
585
+ ]
586
+
587
+ results = list (wtp .parse_patch (text ))
588
+ print results
589
+ self .assertEqual (results , expected )
512
590
513
591
def test_git_header (self ):
514
592
text = """
0 commit comments