Files
CLIProxyAPI/internal/pluginhost/support_test.go
Luis Pater 60abf6ba15 fix(pluginhost): advertise Windows plugin support without cgo
- Select the plugin-capable support flag on Windows even when CGO is disabled.
- Add a regression test for Windows no-CGO build constraints.

Closes: #7977
2026-11-24 08:36:11 +08:00

29 lines
771 B
Go

package pluginhost
import (
"go/build"
"testing"
)
func TestSupportFilesForWindowsWithoutCGO(t *testing.T) {
buildContext := build.Default
buildContext.GOOS = "windows"
buildContext.CgoEnabled = false
matchSupported, errMatchSupported := buildContext.MatchFile(".", "support_cgo.go")
if errMatchSupported != nil {
t.Fatalf("match support_cgo.go: %v", errMatchSupported)
}
matchUnsupported, errMatchUnsupported := buildContext.MatchFile(".", "support_nocgo.go")
if errMatchUnsupported != nil {
t.Fatalf("match support_nocgo.go: %v", errMatchUnsupported)
}
if !matchSupported {
t.Fatal("support_cgo.go is excluded from Windows builds without CGO")
}
if matchUnsupported {
t.Fatal("support_nocgo.go is included in Windows builds without CGO")
}
}