Improved build tests
All checks were successful
/ test (push) Successful in 17s

This commit is contained in:
Eduard Urbach 2025-06-20 13:16:44 +02:00
parent c35f8ff05c
commit aae75197e9
Signed by: akyoto
GPG key ID: 49226B848C78F6C8
6 changed files with 87 additions and 90 deletions

View file

@ -0,0 +1,40 @@
package build_test
import (
"fmt"
"path/filepath"
"runtime"
"testing"
"git.urbach.dev/cli/q/src/build"
"git.urbach.dev/cli/q/src/global"
"git.urbach.dev/go/assert"
)
func TestExecutable(t *testing.T) {
osList := []string{"linux", "darwin", "windows"}
archList := []string{"amd64", "arm64"}
fileList := []string{"../../examples/hello", "../../examples/hello/hello.q"}
for _, os := range osList {
for _, arch := range archList {
t.Run(fmt.Sprintf("%s-%s", os, arch), func(t *testing.T) {
for _, file := range fileList {
global.HostOS = os
global.HostArch = arch
b := build.New(file)
exe := filepath.Base(b.Executable())
if os == "windows" {
assert.Equal(t, exe, "hello.exe")
} else {
assert.Equal(t, exe, "hello")
}
}
})
}
}
global.HostOS = runtime.GOOS
global.HostArch = runtime.GOARCH
}