mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-04-26 21:05:30 +00:00
allow struct based processors to also operate on pointers to structs
This commit is contained in:
@@ -72,6 +72,12 @@ func TestGoodStructFieldGet(t *testing.T) {
|
||||
payload: TestStruct{Bool: true},
|
||||
expected: true,
|
||||
},
|
||||
{
|
||||
name: "pointer to struct payload",
|
||||
params: map[string]any{"name": "Data"},
|
||||
payload: &TestStruct{Data: "hello"},
|
||||
expected: "hello",
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
|
||||
@@ -89,6 +89,14 @@ func TestGoodStructMethodGet(t *testing.T) {
|
||||
payload: TestStruct{},
|
||||
expected: nil,
|
||||
},
|
||||
{
|
||||
name: "pointer to struct payload",
|
||||
params: map[string]any{
|
||||
"name": "GetData",
|
||||
},
|
||||
payload: &TestStruct{Data: "hello"},
|
||||
expected: "hello",
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
|
||||
Reference in New Issue
Block a user