Skip to content

Commit

Permalink
Temporary fix for consistency tests due to language change in for loops
Browse files Browse the repository at this point in the history
  • Loading branch information
mvertes committed Mar 4, 2024
1 parent ee3f46e commit 7f26c0b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions interp/interp_consistent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
"testing"

Expand All @@ -15,6 +16,13 @@ import (
"github.com/traefik/yaegi/stdlib/unsafe"
)

// The following tests depend on an incompatible language change in go1.22, where `for` variables are now
// defined in body (thus reallocated at each loop). We skip them until both supported versions behave the same.
// We will remove this in Go1.23.
var testsToSkipGo122 = map[string]bool{"closure9.go": true, "closure10.go": true, "closure11.go": true, "closure12.go": true}

var go122 = strings.HasPrefix(runtime.Version(), "go1.22")

func TestInterpConsistencyBuild(t *testing.T) {
if testing.Short() {
t.Skip("short mode")
Expand Down Expand Up @@ -125,6 +133,9 @@ func TestInterpConsistencyBuild(t *testing.T) {
if go121 && testsToSkipGo121[file.Name()] {
continue
}
if go122 && testsToSkipGo122[file.Name()] {
continue
}

file := file
t.Run(file.Name(), func(t *testing.T) {
Expand Down

0 comments on commit 7f26c0b

Please sign in to comment.