Skip to content

Commit 7408859

Browse files
committed
fix struct ptr
1 parent 5b42a4b commit 7408859

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

decode_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ func TestDecodePointerField(t *testing.T) {
155155
type DataType struct {
156156
Val *string `instruct:"header"`
157157
S *SData `instruct:"recurse"`
158-
S2 ***SData `instruct:"recurse"`
158+
S2 **SData `instruct:"recurse"`
159+
S3 ***SData `instruct:"recurse"`
159160
IntVal *int32 `instruct:"header"`
160161
}
161162

@@ -176,6 +177,10 @@ func TestDecodePointerField(t *testing.T) {
176177
require.Equal(t, int32(92), *data.IntVal)
177178
require.Equal(t, "x1", data.S.Val)
178179
require.Equal(t, int32(92), *data.S.IntVal)
180+
require.Equal(t, "x1", (*data.S2).Val)
181+
require.Equal(t, int32(92), *(*data.S2).IntVal)
182+
require.Equal(t, "x1", (**data.S3).Val)
183+
require.Equal(t, int32(92), *(**data.S3).IntVal)
179184
}
180185

181186
func TestDecodePointerPointerField(t *testing.T) {

0 commit comments

Comments
 (0)