File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -558,3 +558,22 @@ func TestDifferQFormat(t *testing.T) {
558
558
t .Fatal ("Differ QFormat() failure:" , out )
559
559
}
560
560
}
561
+
562
+ func TestGetUnifiedDiffString (t * testing.T ) {
563
+ A := "one\n two\n three\n four\n five\n six\n seven\n eight\n nine\n ten\n "
564
+ B := "one\n two\n thr33\n four\n five\n six\n seven\n eight\n nine\n ten\n "
565
+ // Build diff
566
+ diff := UnifiedDiff {A : SplitLines (A ),
567
+ FromFile : "file" , FromDate : "then" ,
568
+ B : SplitLines (B ),
569
+ ToFile : "tile" , ToDate : "now" , Eol : "" , Context : 1 }
570
+ // Run test
571
+ diffStr , err := GetUnifiedDiffString (diff )
572
+ if err != nil {
573
+ t .Fatal ("GetUnifiedDiffString error:" , err )
574
+ }
575
+ exp := "--- file\t then\n +++ tile\t now\n @@ -2,3 +2,3 @@\n two\n -three\n +thr33\n four\n "
576
+ if diffStr != exp {
577
+ t .Fatal ("GetUnifiedDiffString failure:" , diffStr )
578
+ }
579
+ }
You can’t perform that action at this time.
0 commit comments