mirror of
https://github.com/hanzoai/pack.git
synced 2026-09-30 23:43:13 +00:00
- Migrate module path to github.com/hanzoai/pack across all Go packages - Remove legacy upstream docs and competitor brand references - Modernize LLM.md and mise.toml for pristine Hanzo Pack builder
33 lines
796 B
Go
33 lines
796 B
Go
// testing utilities
|
|
package testing
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/hanzoai/pack/core/app"
|
|
"github.com/hanzoai/pack/core/config"
|
|
"github.com/hanzoai/pack/core/generate"
|
|
"github.com/hanzoai/pack/core/logger"
|
|
)
|
|
|
|
// CreateGenerateContext creates a new GenerateContext for testing purposes
|
|
func CreateGenerateContext(t *testing.T, path string) *generate.GenerateContext {
|
|
t.Helper() // This marks the function as a test helper, which improves test output
|
|
|
|
userApp, err := app.NewApp(path)
|
|
if err != nil {
|
|
t.Fatalf("error creating app: %v", err)
|
|
}
|
|
|
|
env := app.NewEnvironment(nil)
|
|
|
|
config := config.EmptyConfig()
|
|
|
|
ctx, err := generate.NewGenerateContext(userApp, env, config, logger.NewLogger())
|
|
if err != nil {
|
|
t.Fatalf("error creating generate context: %v", err)
|
|
}
|
|
|
|
return ctx
|
|
}
|