By using Implement you can provide a definition of a function, taking the signature from a stub in the package. One major benefit of this approach is it makes it easy to handle external types in the function signature. Updates #55
18 lines
310 B
Go
18 lines
310 B
Go
package ext
|
|
|
|
import (
|
|
"testing"
|
|
"testing/quick"
|
|
|
|
"github.com/mmcloughlin/avo/examples/ext/ext"
|
|
)
|
|
|
|
//go:generate go run asm.go -out ext.s
|
|
|
|
func TestFunc(t *testing.T) {
|
|
expect := func(e ext.Struct) byte { return e.B }
|
|
if err := quick.CheckEqual(StructFieldB, expect, nil); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|