Complete architectural overhaul of pkg/core:
- All subsystem types renamed to idiomatic Go (no stutter)
- Core struct: App, Embed, Fs, Config, ErrPan, ErrLog, Cli, Service, Lock, Ipc, I18n
- Exports consolidated in core.go, contracts/options in contract.go
- Service() unified get/register: c.Service(), c.Service("name"), c.Service("name", svc)
- Lock() named mutex map: c.Lock("srv"), c.Lock("ipc")
- Error system: Err/ErrLog/ErrPan + Log/LogErr/LogPan (shared ErrSink interface)
- CoreCommand with optional description (i18n resolves from command path)
- Tests moved to tests/ directory (black-box package core_test)
- Removed: ServiceFor/MustServiceFor, global instance, Display/Workspace/Crypt interfaces
- New files: app.go, fs.go, ipc.go, lock.go, i18n.go, task.go, runtime.go, contract.go
Co-Authored-By: Virgil <virgil@lethean.io>
20 lines
422 B
Go
20 lines
422 B
Go
package core_test
|
|
|
|
|
|
import (
|
|
. "forge.lthn.ai/core/go/pkg/core"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestNewWithFactories_EmptyName(t *testing.T) {
|
|
factories := map[string]ServiceFactory{
|
|
"": func() (any, error) {
|
|
return &MockService{Name: "test"}, nil
|
|
},
|
|
}
|
|
_, err := NewWithFactories(nil, factories)
|
|
assert.Error(t, err)
|
|
assert.Contains(t, err.Error(), "service name cannot be empty")
|
|
}
|