@@ -721,17 +721,17 @@ func TestGeneratePatchForUnchangedLineFromReader(t *testing.T) {
721721 },
722722 {
723723 name : "multi-line context" ,
724- content : "package main\n \n func main() {\n \t fmt .Println(\" Hello\" )\n }\n " ,
724+ content : "package main\n \n func main() {\n fmt .Println(\" Hello\" )\n }\n " ,
725725 treePath : "main.go" ,
726726 line : 4 ,
727727 contextLines : 2 ,
728728 want : `diff --git a/main.go b/main.go
729729--- a/main.go
730730+++ b/main.go
731731@@ -2,3 +2,3 @@
732-
732+ <SP>
733733 func main() {
734- fmt.Println("Hello")
734+ fmt.Println("Hello")
735735` ,
736736 },
737737 {
@@ -752,7 +752,7 @@ func TestGeneratePatchForUnchangedLineFromReader(t *testing.T) {
752752 assert .Error (t , err )
753753 } else {
754754 require .NoError (t , err )
755- assert .Equal (t , tt .want , got )
755+ assert .Equal (t , strings . ReplaceAll ( tt .want , "<SP>" , " " ) , got )
756756 }
757757 })
758758 }
@@ -820,38 +820,16 @@ func TestCalculateHiddenCommentIDsForLine(t *testing.T) {
820820 },
821821 lineComments : map [int64 ][]* issues_model.Comment {
822822 10 : {{ID : 100 }}, // at LastRightIdx, should not be included
823- 20 : {{ID : 101 }}, // at RightIdx, should not be included
823+ 20 : {{ID : 101 }}, // at RightIdx, should be included
824824 11 : {{ID : 102 }}, // just inside range, should be included
825825 19 : {{ID : 103 }}, // just inside range, should be included
826826 },
827- expected : []int64 {102 , 103 },
828- },
829- {
830- name : "not a section line" ,
831- line : & DiffLine {
832- Type : DiffLinePlain ,
833- },
834- lineComments : map [int64 ][]* issues_model.Comment {
835- 15 : {{ID : 100 }},
836- },
837- expected : nil ,
838- },
839- {
840- name : "section line without section info" ,
841- line : & DiffLine {
842- Type : DiffLineSection ,
843- SectionInfo : nil ,
844- },
845- lineComments : map [int64 ][]* issues_model.Comment {
846- 15 : {{ID : 100 }},
847- },
848- expected : nil ,
827+ expected : []int64 {101 , 102 , 103 },
849828 },
850829 }
851830
852831 for _ , tt := range tests {
853832 t .Run (tt .name , func (t * testing.T ) {
854- tt .line .SectionInfo = & DiffLineSectionInfo {}
855833 FillHiddenCommentIDsForDiffLine (tt .line , tt .lineComments )
856834 assert .ElementsMatch (t , tt .expected , tt .line .SectionInfo .HiddenCommentIDs )
857835 })
0 commit comments