mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-07 04:23:41 +00:00
@@ -560,7 +560,7 @@ type methodStruct struct {
|
||||
i int
|
||||
}
|
||||
|
||||
func (m methodStruct) valueMethod1() int {
|
||||
func (m methodStruct) ValueMethod1() int {
|
||||
return m.i
|
||||
}
|
||||
|
||||
@@ -568,11 +568,11 @@ func (m methodStruct) valueMethod2() int {
|
||||
return m.i
|
||||
}
|
||||
|
||||
func (m *methodStruct) pointerMethod1() int {
|
||||
func (m *methodStruct) PointerMethod1() int {
|
||||
return m.i
|
||||
}
|
||||
|
||||
func (m *methodStruct) pointerMethod2() int {
|
||||
func (m *methodStruct) PointerMethod2() int {
|
||||
return m.i
|
||||
}
|
||||
|
||||
@@ -582,12 +582,12 @@ func (m *methodStruct) pointerMethod3() int {
|
||||
|
||||
func TestTinyNumMethods(t *testing.T) {
|
||||
refptrt := TypeOf(&methodStruct{})
|
||||
if got, want := refptrt.NumMethod(), 2+3; got != want {
|
||||
if got, want := refptrt.NumMethod(), 1+2; got != want {
|
||||
t.Errorf("Pointer Methods=%v, want %v", got, want)
|
||||
}
|
||||
|
||||
reft := refptrt.Elem()
|
||||
if got, want := reft.NumMethod(), 2; got != want {
|
||||
if got, want := reft.NumMethod(), 1; got != want {
|
||||
t.Errorf("Value Methods=%v, want %v", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user