Refactored code structure
This commit is contained in:
37
src/build/build_test.go
Normal file
37
src/build/build_test.go
Normal file
@ -0,0 +1,37 @@
|
||||
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)
|
||||
}
|
Reference in New Issue
Block a user