This commit is contained in:
parent
c35f8ff05c
commit
aae75197e9
6 changed files with 87 additions and 90 deletions
40
src/build/Executable_test.go
Normal file
40
src/build/Executable_test.go
Normal 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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue