38 lines
786 B
Go
38 lines
786 B
Go
package build_test
|
|
|
|
import (
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"git.akyoto.dev/cli/q/src/build"
|
|
"git.akyoto.dev/go/assert"
|
|
)
|
|
|
|
func TestBuildDirectory(t *testing.T) {
|
|
b := build.New("../../examples/hello")
|
|
_, err := b.Run()
|
|
assert.Nil(t, err)
|
|
}
|
|
|
|
func TestBuildFile(t *testing.T) {
|
|
b := build.New("../../examples/hello/hello.q")
|
|
_, err := b.Run()
|
|
assert.Nil(t, err)
|
|
}
|
|
|
|
func TestExecutableFromDirectory(t *testing.T) {
|
|
b := build.New("../../examples/hello")
|
|
assert.Equal(t, filepath.Base(b.Executable()), "hello")
|
|
}
|
|
|
|
func TestExecutableFromFile(t *testing.T) {
|
|
b := build.New("../../examples/hello/hello.q")
|
|
assert.Equal(t, filepath.Base(b.Executable()), "hello")
|
|
}
|
|
|
|
func TestNonExisting(t *testing.T) {
|
|
b := build.New("does-not-exist")
|
|
_, err := b.Run()
|
|
assert.NotNil(t, err)
|
|
}
|