gotypes,tests: test case for issue #195 (#214)

Adds test cases for the bug in #195, similar to #212.

Updates #195
Updates #191
This commit is contained in:
Michael McLoughlin
2021-10-30 13:47:55 -07:00
committed by GitHub
parent 7de02518a2
commit 4f7179b08e
6 changed files with 43 additions and 1 deletions

View File

@@ -159,7 +159,8 @@ func TestSignatureSizes(t *testing.T) {
{"func(uint64) uint64", 16}, {"func(uint64) uint64", 16},
{"func([7]byte) byte", 9}, {"func([7]byte) byte", 9},
{"func(uint64, uint64) (uint64, uint64)", 32}, {"func(uint64, uint64) (uint64, uint64)", 32},
{"func(uint16)", 2}, {"func(uint16)", 2}, // issue #191
{"func(*uint64, uint32)", 12}, // issue #195
} }
for _, c := range cases { for _, c := range cases {
s, err := ParseSignature(c.Expr) s, err := ParseSignature(c.Expr)

View File

@@ -0,0 +1,15 @@
//go:build ignore
// +build ignore
package main
import (
. "github.com/mmcloughlin/avo/build"
)
func main() {
TEXT("Issue195", NOSPLIT|NOFRAME, "func(x *uint64, y uint32)")
Doc("Issue195 tests for correct argument size.")
RET()
Generate()
}

View File

@@ -0,0 +1,3 @@
// Package issue195 tests for correct argument size for a function without
// return types. This test is closely related to issue #191.
package issue195

View File

@@ -0,0 +1,7 @@
// Code generated by command: go run asm.go -out issue195.s -stubs stub.go. DO NOT EDIT.
#include "textflag.h"
// func Issue195(x *uint64, y uint32)
TEXT ·Issue195(SB), NOSPLIT|NOFRAME, $0-12
RET

View File

@@ -0,0 +1,10 @@
package issue195
import "testing"
//go:generate go run asm.go -out issue195.s -stubs stub.go
func TestIssue195(t *testing.T) {
x := uint64(42)
Issue195(&x, 42)
}

View File

@@ -0,0 +1,6 @@
// Code generated by command: go run asm.go -out issue195.s -stubs stub.go. DO NOT EDIT.
package issue195
// Issue195 tests for correct argument size.
func Issue195(x *uint64, y uint32)