diff --git a/internal/processor/test/processor_test.go b/internal/processor/test/processor_test.go index c77125e..42964a0 100644 --- a/internal/processor/test/processor_test.go +++ b/internal/processor/test/processor_test.go @@ -10,11 +10,12 @@ import ( ) type TestStruct struct { - String string - Int int - Float float64 - Bool bool - Data any + String string + Int int + Float float64 + Bool bool + Data any + IntSlice []int } func (t TestStruct) GetString() string { @@ -37,6 +38,10 @@ func (t TestStruct) GetData() any { return t.Data } +func (t TestStruct) GetIntSlice() []int { + return t.IntSlice +} + func (t TestStruct) Void() {} type TestProcessor struct { diff --git a/internal/processor/test/struct-field-get_test.go b/internal/processor/test/struct-field-get_test.go index 1a691d1..e26586a 100644 --- a/internal/processor/test/struct-field-get_test.go +++ b/internal/processor/test/struct-field-get_test.go @@ -1,6 +1,7 @@ package processor_test import ( + "reflect" "testing" "github.com/jwetzell/showbridge-go/internal/common" @@ -79,6 +80,14 @@ func TestGoodStructFieldGet(t *testing.T) { payload: &TestStruct{Data: "hello"}, expected: "hello", }, + { + name: "int slice", + params: map[string]any{ + "name": "IntSlice", + }, + payload: TestStruct{IntSlice: []int{1, 2, 3}}, + expected: []int{1, 2, 3}, + }, } for _, test := range tests { @@ -103,7 +112,7 @@ func TestGoodStructFieldGet(t *testing.T) { t.Fatalf("struct.field.get processing failed: %s", err) } - if got.Payload != test.expected { + if !reflect.DeepEqual(got.Payload, test.expected) { t.Fatalf("struct.field.get got %+v, expected %s", got, test.expected) } }) diff --git a/internal/processor/test/struct-method-get_test.go b/internal/processor/test/struct-method-get_test.go index 32afaaa..8643482 100644 --- a/internal/processor/test/struct-method-get_test.go +++ b/internal/processor/test/struct-method-get_test.go @@ -98,6 +98,14 @@ func TestGoodStructMethodGet(t *testing.T) { payload: &TestStruct{Data: "hello"}, expected: "hello", }, + { + name: "int slice", + params: map[string]any{ + "name": "GetIntSlice", + }, + payload: TestStruct{IntSlice: []int{1, 2, 3}}, + expected: []int{1, 2, 3}, + }, } for _, test := range tests {