mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-11-29 13:23:04 +08:00
- 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
29 lines
771 B
Go
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")
|
|
}
|
|
}
|