aboutsummaryrefslogtreecommitdiffhomepage
path: root/compiler/compiler_test.go
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2023-01-13 17:52:18 +0000
committerRon Evans <[email protected]>2023-01-17 08:38:54 +0100
commitc43958972c3ffcd51e65414a346e53779edb9f97 (patch)
tree8335e533ad0d96e4f074f49190af3e707d4785bc /compiler/compiler_test.go
parent33489d6344c05e14aaea8faf33a2b5b73c886215 (diff)
downloadtinygo-c43958972c3ffcd51e65414a346e53779edb9f97.tar.gz
tinygo-c43958972c3ffcd51e65414a346e53779edb9f97.zip
compiler: add support for new unsafe slice/string functions
This adds support for unsafe.SliceData, unsafe.String, and unsafe.SringData that were introduced in Go 1.20.
Diffstat (limited to 'compiler/compiler_test.go')
-rw-r--r--compiler/compiler_test.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler/compiler_test.go b/compiler/compiler_test.go
index a5cd9c6bf..f8221a08e 100644
--- a/compiler/compiler_test.go
+++ b/compiler/compiler_test.go
@@ -9,6 +9,7 @@ import (
"testing"
"github.com/tinygo-org/tinygo/compileopts"
+ "github.com/tinygo-org/tinygo/goenv"
"github.com/tinygo-org/tinygo/loader"
"tinygo.org/x/go-llvm"
)
@@ -27,6 +28,12 @@ type testCase struct {
func TestCompiler(t *testing.T) {
t.Parallel()
+ // Determine Go minor version (e.g. 16 in go1.16.3).
+ _, goMinor, err := goenv.GetGorootVersion(goenv.Get("GOROOT"))
+ if err != nil {
+ t.Fatal("could not read Go version:", err)
+ }
+
// Determine which tests to run, depending on the Go and LLVM versions.
tests := []testCase{
{"basic.go", "", ""},
@@ -43,6 +50,9 @@ func TestCompiler(t *testing.T) {
{"channel.go", "", ""},
{"gc.go", "", ""},
}
+ if goMinor >= 20 {
+ tests = append(tests, testCase{"go1.20.go", "", ""})
+ }
for _, tc := range tests {
name := tc.file