aboutsummaryrefslogtreecommitdiff
path: root/hotline
diff options
context:
space:
mode:
authorJeff Halter <868228+jhalter@users.noreply.github.com>2024-07-19 13:43:09 -0700
committerJeff Halter <868228+jhalter@users.noreply.github.com>2024-07-19 13:43:09 -0700
commit50c837fe10df05b9cc08decb1add122fb935e8fa (patch)
tree9ec18b0e38b1c627cd35208d6fc78a90e3aeec9d /hotline
parent6eaf9391526a808c0056427f056169311352446d (diff)
Fix failing test, replace use of reflect package with assert
Diffstat (limited to 'hotline')
-rw-r--r--hotline/file_name_with_info_test.go3
-rw-r--r--hotline/file_transfer_test.go5
-rw-r--r--hotline/files_test.go4
-rw-r--r--hotline/tracker_test.go4
4 files changed, 7 insertions, 9 deletions
diff --git a/hotline/file_name_with_info_test.go b/hotline/file_name_with_info_test.go
index d1b03c2..5095acf 100644
--- a/hotline/file_name_with_info_test.go
+++ b/hotline/file_name_with_info_test.go
@@ -3,7 +3,6 @@ package hotline
import (
"github.com/stretchr/testify/assert"
"io"
- "reflect"
"testing"
)
@@ -54,7 +53,7 @@ func TestFileNameWithInfo_MarshalBinary(t *testing.T) {
t.Errorf("MarshalBinary() error = %v, wantErr %v", err, tt.wantErr)
return
}
- if !reflect.DeepEqual(gotData, tt.wantData) {
+ if !assert.Equal(t, tt.wantData, gotData) {
t.Errorf("MarshalBinary() gotData = %v, want %v", gotData, tt.wantData)
}
})
diff --git a/hotline/file_transfer_test.go b/hotline/file_transfer_test.go
index b1236b6..0b549f8 100644
--- a/hotline/file_transfer_test.go
+++ b/hotline/file_transfer_test.go
@@ -4,7 +4,6 @@ import (
"encoding/binary"
"github.com/stretchr/testify/assert"
"io"
- "reflect"
"testing"
)
@@ -127,7 +126,7 @@ func TestNewFileHeader(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
- if got := NewFileHeader(tt.args.fileName, tt.args.isDir); !reflect.DeepEqual(got, tt.want) {
+ if got := NewFileHeader(tt.args.fileName, tt.args.isDir); !assert.Equal(t, tt.want, got) {
t.Errorf("NewFileHeader() = %v, want %v", got, tt.want)
}
})
@@ -170,7 +169,7 @@ func TestFileHeader_Payload(t *testing.T) {
FilePath: tt.fields.FilePath,
}
got, _ := io.ReadAll(fh)
- if !reflect.DeepEqual(got, tt.want) {
+ if !assert.Equal(t, tt.want, got) {
t.Errorf("Read() = %v, want %v", got, tt.want)
}
})
diff --git a/hotline/files_test.go b/hotline/files_test.go
index 4c8ef80..0a7eb7b 100644
--- a/hotline/files_test.go
+++ b/hotline/files_test.go
@@ -3,9 +3,9 @@ package hotline
import (
"bytes"
"encoding/binary"
+ "github.com/stretchr/testify/assert"
"os"
"path/filepath"
- "reflect"
"testing"
)
@@ -77,7 +77,7 @@ func TestCalcTotalSize(t *testing.T) {
t.Errorf("CalcTotalSize() error = %v, wantErr %v", err, tt.wantErr)
return
}
- if !reflect.DeepEqual(got, tt.want) {
+ if !assert.Equal(t, tt.want, got) {
t.Errorf("CalcTotalSize() got = %v, want %v", got, tt.want)
}
})
diff --git a/hotline/tracker_test.go b/hotline/tracker_test.go
index 14c0363..5457e47 100644
--- a/hotline/tracker_test.go
+++ b/hotline/tracker_test.go
@@ -6,7 +6,6 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"io"
- "reflect"
"testing"
)
@@ -42,6 +41,7 @@ func TestTrackerRegistration_Payload(t *testing.T) {
0x54, 0x65, 0x73, 0x74, 0x20, 0x53, 0x65, 0x72, 0x76,
0x04,
0x46, 0x6f, 0x6f, 0x7a,
+ 0x00,
},
},
}
@@ -55,7 +55,7 @@ func TestTrackerRegistration_Payload(t *testing.T) {
Description: tt.fields.Description,
}
- if got, _ := io.ReadAll(tr); !reflect.DeepEqual(got, tt.want) {
+ if got, _ := io.ReadAll(tr); !assert.Equal(t, tt.want, got) {
t.Errorf("Read() = %v, want %v", got, tt.want)
}
})