]> git.r.bdr.sh - rbdr/mobius/blobdiff - hotline/file_name_with_info_test.go
Account for the root
[rbdr/mobius] / hotline / file_name_with_info_test.go
index 321e2473e2e3892ed331a0f0fc78ea937af334f3..5095acf53b37b1ebff950ba0ede5d7305f79bec2 100644 (file)
@@ -3,13 +3,12 @@ package hotline
 import (
        "github.com/stretchr/testify/assert"
        "io"
-       "reflect"
        "testing"
 )
 
 func TestFileNameWithInfo_MarshalBinary(t *testing.T) {
        type fields struct {
-               fileNameWithInfoHeader fileNameWithInfoHeader
+               fileNameWithInfoHeader FileNameWithInfoHeader
                name                   []byte
        }
        tests := []struct {
@@ -21,7 +20,7 @@ func TestFileNameWithInfo_MarshalBinary(t *testing.T) {
                {
                        name: "returns expected bytes",
                        fields: fields{
-                               fileNameWithInfoHeader: fileNameWithInfoHeader{
+                               fileNameWithInfoHeader: FileNameWithInfoHeader{
                                        Type:       [4]byte{0x54, 0x45, 0x58, 0x54}, // TEXT
                                        Creator:    [4]byte{0x54, 0x54, 0x58, 0x54}, // TTXT
                                        FileSize:   [4]byte{0x00, 0x43, 0x16, 0xd3}, // File Size
@@ -46,7 +45,7 @@ func TestFileNameWithInfo_MarshalBinary(t *testing.T) {
        for _, tt := range tests {
                t.Run(tt.name, func(t *testing.T) {
                        f := &FileNameWithInfo{
-                               fileNameWithInfoHeader: tt.fields.fileNameWithInfoHeader,
+                               FileNameWithInfoHeader: tt.fields.fileNameWithInfoHeader,
                                Name:                   tt.fields.name,
                        }
                        gotData, err := io.ReadAll(f)
@@ -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)
                        }
                })
@@ -63,7 +62,7 @@ func TestFileNameWithInfo_MarshalBinary(t *testing.T) {
 
 func TestFileNameWithInfo_UnmarshalBinary(t *testing.T) {
        type fields struct {
-               fileNameWithInfoHeader fileNameWithInfoHeader
+               fileNameWithInfoHeader FileNameWithInfoHeader
                name                   []byte
        }
        type args struct {
@@ -90,7 +89,7 @@ func TestFileNameWithInfo_UnmarshalBinary(t *testing.T) {
                                },
                        },
                        want: &FileNameWithInfo{
-                               fileNameWithInfoHeader: fileNameWithInfoHeader{
+                               FileNameWithInfoHeader: FileNameWithInfoHeader{
                                        Type:       [4]byte{0x54, 0x45, 0x58, 0x54}, // TEXT
                                        Creator:    [4]byte{0x54, 0x54, 0x58, 0x54}, // TTXT
                                        FileSize:   [4]byte{0x00, 0x43, 0x16, 0xd3}, // File Size
@@ -106,7 +105,7 @@ func TestFileNameWithInfo_UnmarshalBinary(t *testing.T) {
        for _, tt := range tests {
                t.Run(tt.name, func(t *testing.T) {
                        f := &FileNameWithInfo{
-                               fileNameWithInfoHeader: tt.fields.fileNameWithInfoHeader,
+                               FileNameWithInfoHeader: tt.fields.fileNameWithInfoHeader,
                                Name:                   tt.fields.name,
                        }
                        if _, err := f.Write(tt.args.data); (err != nil) != tt.wantErr {