Skip to content

Commit 9da31d6

Browse files
committed
Add arm64-specific test cases
1 parent c7993f0 commit 9da31d6

2 files changed

Lines changed: 96 additions & 0 deletions

File tree

testdata/src/a/a_arm64.go

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package a
2+
3+
type PointerGood struct {
4+
P *int
5+
buf [1000]uintptr
6+
}
7+
8+
type PointerBad struct { // want "struct with 8008 pointer bytes could be 8"
9+
buf [1000]uintptr
10+
P *int
11+
}
12+
13+
type PointerSorta struct {
14+
a struct {
15+
p *int
16+
q uintptr
17+
}
18+
b struct {
19+
p *int
20+
q [2]uintptr
21+
}
22+
}
23+
24+
type PointerSortaBad struct { // want "struct with 32 pointer bytes could be 24"
25+
a struct {
26+
p *int
27+
q [2]uintptr
28+
}
29+
b struct {
30+
p *int
31+
q uintptr
32+
}
33+
}
34+
35+
type MultiField struct { // want "struct of size 40 could be 24"
36+
b bool
37+
i1, i2 int
38+
a3 [3]bool
39+
_ [0]func()
40+
}
41+
42+
type Issue43233 struct { // want "struct with 88 pointer bytes could be 80"
43+
AllowedEvents []*string // allowed events
44+
BlockedEvents []*string // blocked events
45+
APIVersion string `mapstructure:"api_version"`
46+
BaseURL string `mapstructure:"base_url"`
47+
AccessToken string `mapstructure:"access_token"`
48+
}

testdata/src/a/a_arm64.go.golden

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package a
2+
3+
type PointerGood struct {
4+
P *int
5+
buf [1000]uintptr
6+
}
7+
8+
type PointerBad struct { // want "struct with 8008 pointer bytes could be 8"
9+
P *int
10+
buf [1000]uintptr
11+
}
12+
13+
type PointerSorta struct {
14+
a struct {
15+
p *int
16+
q uintptr
17+
}
18+
b struct {
19+
p *int
20+
q [2]uintptr
21+
}
22+
}
23+
24+
type PointerSortaBad struct { // want "struct with 32 pointer bytes could be 24"
25+
b struct {
26+
p *int
27+
q uintptr
28+
}
29+
a struct {
30+
p *int
31+
q [2]uintptr
32+
}
33+
}
34+
35+
type MultiField struct { // want "struct of size 40 could be 24"
36+
_ [0]func()
37+
i1, i2 int
38+
a3 [3]bool
39+
b bool
40+
}
41+
42+
type Issue43233 struct { // want "struct with 88 pointer bytes could be 80"
43+
APIVersion string `mapstructure:"api_version"`
44+
BaseURL string `mapstructure:"base_url"`
45+
AccessToken string `mapstructure:"access_token"`
46+
AllowedEvents []*string // allowed events
47+
BlockedEvents []*string // blocked events
48+
}

0 commit comments

Comments
 (0)