@@ -67,40 +67,35 @@ func TestFigureOutResources(t *testing.T) {
6767 }
6868}
6969
70- func TestConflictResolution (t * testing.T ) {
71- ResultHead := isValidResolutionPolicy ("USE_HEAD" )
72- assert .Equal (t , ResultHead , true )
73-
74- ResultBase := isValidResolutionPolicy ("USE_BASE" )
75- assert .Equal (t , ResultBase , true )
76-
77- WrongResult := isValidResolutionPolicy ("WRONG_BASE" )
78- if WrongResult == true {
79- t .Error ("Should be error" )
80- }
81-
70+ func mockGetSize (fd int ) (int , int , error ) {
71+ return 80 , 0 , nil
8272}
8373
8474func TestTruncateMessage (t * testing.T ) {
75+ // Backup the original function
76+ originalGetSizeFunc := getSizeFunc
77+ defer func () { getSizeFunc = originalGetSizeFunc }()
78+
79+ // Test with 80 character terminal width
80+ getSizeFunc = mockGetSize
8581 result := truncateMessage ("short message" )
86- assert .Equal (t , result , "short message" )
82+ assert .Equal (t , "short message" , result )
8783
8884 result = truncateMessage (
89- "this is a long message that needs to be truncated because it exceeds " +
90- "the maximum length of 75 characters" ,
85+ "this is a long message that needs to be truncated because it exceeds the maximum length of 75 characters" ,
9186 )
9287 assert .Equal (
9388 t ,
89+ "this is a long message that needs to be truncated because it exceeds the max.." ,
9490 result ,
95- "this is a long message that needs to be truncated because it exceeds the maxim.." ,
9691 )
9792
9893 result = truncateMessage (
9994 "a message with exactly 75 characters - this message should not be truncated" ,
10095 )
10196 assert .Equal (
10297 t ,
103- result ,
10498 "a message with exactly 75 characters - this message should not be truncated" ,
99+ result ,
105100 )
106101}
0 commit comments