- fs.go: propagate validatePath failures (return vp) instead of bare Result{}
- app.go: Find() returns Result instead of *App
- log.go: fmt import removed — uses Sprint/Sprintf/Print from string.go/utils.go
- string.go: added Sprint() and Sprintf() wrappers for any-to-string formatting
Co-Authored-By: Virgil <virgil@lethean.io>
39 lines
768 B
Go
39 lines
768 B
Go
package core_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
. "forge.lthn.ai/core/go/pkg/core"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
// --- App ---
|
|
|
|
func TestApp_Good(t *testing.T) {
|
|
c := New(Options{{K: "name", V: "myapp"}})
|
|
assert.Equal(t, "myapp", c.App().Name)
|
|
}
|
|
|
|
func TestApp_Empty_Good(t *testing.T) {
|
|
c := New()
|
|
assert.NotNil(t, c.App())
|
|
assert.Equal(t, "", c.App().Name)
|
|
}
|
|
|
|
func TestApp_Runtime_Good(t *testing.T) {
|
|
c := New()
|
|
c.App().Runtime = &struct{ Name string }{Name: "wails"}
|
|
assert.NotNil(t, c.App().Runtime)
|
|
}
|
|
|
|
func TestApp_Find_Good(t *testing.T) {
|
|
r := Find("go", "go")
|
|
assert.True(t, r.OK)
|
|
app := r.Value.(*App)
|
|
assert.NotEmpty(t, app.Path)
|
|
}
|
|
|
|
func TestApp_Find_Bad(t *testing.T) {
|
|
r := Find("nonexistent-binary-xyz", "test")
|
|
assert.False(t, r.OK)
|
|
}
|