Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions sig.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,19 +183,19 @@ func (cnt *depthCounter) Valid() bool {
return cnt.arrayDepth <= 32 && cnt.structDepth <= 32 && cnt.dictEntryDepth <= 32
}

func (cnt *depthCounter) EnterArray() *depthCounter {
func (cnt depthCounter) EnterArray() *depthCounter {
cnt.arrayDepth++
return cnt
return &cnt
}

func (cnt *depthCounter) EnterStruct() *depthCounter {
func (cnt depthCounter) EnterStruct() *depthCounter {
cnt.structDepth++
return cnt
return &cnt
}

func (cnt *depthCounter) EnterDictEntry() *depthCounter {
func (cnt depthCounter) EnterDictEntry() *depthCounter {
cnt.dictEntryDepth++
return cnt
return &cnt
}

// Try to read a single type from this string. If it was successful, err is nil
Expand Down
40 changes: 40 additions & 0 deletions sig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,42 @@ import (
"testing"
)

type structWithManyFields struct {
A01 int32
A02 int32
A03 int32
A04 int32
A05 int32
A06 int32
A07 int32
A08 int32
A09 int32
A10 int32
A11 int32
A12 int32
A13 int32
A14 int32
A15 int32
A16 int32
A17 int32
A18 int32
A19 int32
A20 int32
A21 int32
A22 int32
A23 int32
A24 int32
A25 int32
A26 int32
A27 int32
A28 int32
A29 int32
A30 int32
A31 int32
A32 int32
A33 int32
}

var sigTests = []struct {
vs []any
sig Signature
Expand Down Expand Up @@ -36,6 +72,10 @@ var sigTests = []struct {
[]any{new(Variant), new([]map[int32]string)},
Signature{"vaa{is}"},
},
{
[]any{new(structWithManyFields)},
Signature{"(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)"},
},
}

func TestSig(t *testing.T) {
Expand Down