aboutsummaryrefslogtreecommitdiffhomepage
path: root/cgo
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2021-09-09 00:32:31 +0200
committerRon Evans <[email protected]>2021-09-09 13:28:50 +0200
commite9f1ed701ac2b3129855466c397bab843c85954d (patch)
tree8ae3ed071e8f83e65d923ef5f11bd0dd4585c04e /cgo
parent6315db21f7d85f4766589d5b4c8ca6c54aa8e7a4 (diff)
downloadtinygo-e9f1ed701ac2b3129855466c397bab843c85954d.tar.gz
tinygo-e9f1ed701ac2b3129855466c397bab843c85954d.zip
cgo: don't normalize CGo tests anymore
Normalization was required because previously we supported Go 1.13 and Go 1.14 at the same time. Now we've dropped support for both so this normalization is not necessary anymore. CGo support remains the same. It's just the test outputs that aren't normalized anymore.
Diffstat (limited to 'cgo')
-rw-r--r--cgo/cgo_test.go9
-rw-r--r--cgo/testdata/types.out.go20
2 files changed, 5 insertions, 24 deletions
diff --git a/cgo/cgo_test.go b/cgo/cgo_test.go
index 625a11f3f..b18650606 100644
--- a/cgo/cgo_test.go
+++ b/cgo/cgo_test.go
@@ -12,7 +12,6 @@ import (
"go/types"
"io/ioutil"
"path/filepath"
- "regexp"
"runtime"
"strings"
"testing"
@@ -25,14 +24,6 @@ var flagUpdate = flag.Bool("update", false, "Update images based on test output.
// platforms and Go versions.
func normalizeResult(result string) string {
actual := strings.ReplaceAll(result, "\r\n", "\n")
-
- // Make sure all functions are wrapped, even those that would otherwise be
- // single-line functions. This is necessary because Go 1.14 changed the way
- // such functions are wrapped and it's important to have consistent test
- // results.
- re := regexp.MustCompile(`func \((.+)\)( .*?) +{ (.+) }`)
- actual = re.ReplaceAllString(actual, "func ($1)$2 {\n\t$3\n}")
-
return actual
}
diff --git a/cgo/testdata/types.out.go b/cgo/testdata/types.out.go
index c825d5dd5..c89e9b005 100644
--- a/cgo/testdata/types.out.go
+++ b/cgo/testdata/types.out.go
@@ -67,9 +67,7 @@ type C.union3_t = C.union_1
type C.union_nested_t = C.union_3
type C.unionarray_t = struct{ arr [10]C.uchar }
-func (s *C.struct_4) bitfield_a() C.uchar {
- return s.__bitfield_1 & 0x1f
-}
+func (s *C.struct_4) bitfield_a() C.uchar { return s.__bitfield_1 & 0x1f }
func (s *C.struct_4) set_bitfield_a(value C.uchar) {
s.__bitfield_1 = s.__bitfield_1&^0x1f | value&0x1f<<0
}
@@ -105,15 +103,9 @@ type C.struct_type1 struct {
}
type C.struct_type2 struct{ _type C.int }
-func (union *C.union_1) unionfield_i() *C.int {
- return (*C.int)(unsafe.Pointer(&union.$union))
-}
-func (union *C.union_1) unionfield_d() *float64 {
- return (*float64)(unsafe.Pointer(&union.$union))
-}
-func (union *C.union_1) unionfield_s() *C.short {
- return (*C.short)(unsafe.Pointer(&union.$union))
-}
+func (union *C.union_1) unionfield_i() *C.int { return (*C.int)(unsafe.Pointer(&union.$union)) }
+func (union *C.union_1) unionfield_d() *float64 { return (*float64)(unsafe.Pointer(&union.$union)) }
+func (union *C.union_1) unionfield_s() *C.short { return (*C.short)(unsafe.Pointer(&union.$union)) }
type C.union_1 struct{ $union uint64 }
@@ -138,9 +130,7 @@ func (union *C.union_3) unionfield_thing() *C.union3_t {
type C.union_3 struct{ $union [2]uint64 }
-func (union *C.union_union2d) unionfield_i() *C.int {
- return (*C.int)(unsafe.Pointer(&union.$union))
-}
+func (union *C.union_union2d) unionfield_i() *C.int { return (*C.int)(unsafe.Pointer(&union.$union)) }
func (union *C.union_union2d) unionfield_d() *[2]float64 {
return (*[2]float64)(unsafe.Pointer(&union.$union))
}