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

This commit is contained in:
Eduard Urbach 2025-06-19 11:51:38 +02:00
parent d37bbd2d4c
commit f1457af6be
Signed by: akyoto
GPG key ID: 49226B848C78F6C8

View file

@ -8,24 +8,44 @@ import (
"git.urbach.dev/go/assert" "git.urbach.dev/go/assert"
) )
func TestExecutableNameFromDirectory(t *testing.T) { func TestExecutableFromDirectoryLinux(t *testing.T) {
b := build.New("../../examples/hello") b := build.New("../../examples/hello")
b.OS = build.Linux
exe := filepath.Base(b.Executable()) exe := filepath.Base(b.Executable())
if b.OS == build.Windows {
assert.Equal(t, exe, "hello.exe")
} else {
assert.Equal(t, exe, "hello") assert.Equal(t, exe, "hello")
}
} }
func TestExecutableNameFromFile(t *testing.T) { func TestExecutableFromFileLinux(t *testing.T) {
b := build.New("../../examples/hello/hello.q") b := build.New("../../examples/hello/hello.q")
b.OS = build.Linux
exe := filepath.Base(b.Executable()) exe := filepath.Base(b.Executable())
if b.OS == build.Windows {
assert.Equal(t, exe, "hello.exe")
} else {
assert.Equal(t, exe, "hello") assert.Equal(t, exe, "hello")
} }
func TestExecutableFromDirectoryMac(t *testing.T) {
b := build.New("../../examples/hello")
b.OS = build.Mac
exe := filepath.Base(b.Executable())
assert.Equal(t, exe, "hello")
}
func TestExecutableFromFileMac(t *testing.T) {
b := build.New("../../examples/hello/hello.q")
b.OS = build.Mac
exe := filepath.Base(b.Executable())
assert.Equal(t, exe, "hello")
}
func TestExecutableFromDirectoryWindows(t *testing.T) {
b := build.New("../../examples/hello")
b.OS = build.Windows
exe := filepath.Base(b.Executable())
assert.Equal(t, exe, "hello.exe")
}
func TestExecutableFromFileWindows(t *testing.T) {
b := build.New("../../examples/hello/hello.q")
b.OS = build.Windows
exe := filepath.Base(b.Executable())
assert.Equal(t, exe, "hello.exe")
} }