Files
codex-agent-manager/internal/runtime/module_test.go

46 lines
846 B
Go

package runtime
import (
"os"
"path/filepath"
"runtime"
"testing"
)
func TestModuleKeepsGo122Compatibility(t *testing.T) {
if runtime.Version() == "" {
t.Fatal("runtime version unavailable")
}
data, err := os.ReadFile(filepath.Join("..", "..", "go.mod"))
if err != nil {
t.Fatal(err)
}
if !containsLine(string(data), "go 1.22") {
t.Fatalf("go.mod must keep Go 1.22 compatibility, got:\n%s", data)
}
}
func containsLine(input string, want string) bool {
for _, line := range splitLines(input) {
if line == want {
return true
}
}
return false
}
func splitLines(input string) []string {
var lines []string
start := 0
for i, char := range input {
if char == '\n' {
lines = append(lines, input[start:i])
start = i + 1
}
}
if start <= len(input) {
lines = append(lines, input[start:])
}
return lines
}