(t *testing.T)
| 14 | ) |
| 15 | |
| 16 | func TestPromptBuilder_Basic(t *testing.T) { |
| 17 | deps := setupPromptTestDeps(t) |
| 18 | |
| 19 | config := &types.AgentConfig{ |
| 20 | TemplateID: "test-template", |
| 21 | ModelConfig: &types.ModelConfig{ |
| 22 | Provider: "anthropic", |
| 23 | Model: "claude-sonnet-4-5", |
| 24 | APIKey: "test-key", |
| 25 | }, |
| 26 | Sandbox: &types.SandboxConfig{ |
| 27 | Kind: types.SandboxKindMock, |
| 28 | WorkDir: "/tmp/test", |
| 29 | }, |
| 30 | } |
| 31 | |
| 32 | ag, err := Create(context.Background(), config, deps) |
| 33 | if err != nil { |
| 34 | t.Fatalf("Failed to create agent: %v", err) |
| 35 | } |
| 36 | defer func() { _ = ag.Close() }() |
| 37 | |
| 38 | // 获取 System Prompt |
| 39 | systemPrompt := ag.GetSystemPrompt() |
| 40 | |
| 41 | // 验证基础 Prompt 存在 |
| 42 | if !strings.Contains(systemPrompt, "You are a test assistant") { |
| 43 | t.Error("System prompt should contain base prompt") |
| 44 | } |
| 45 | |
| 46 | // 验证环境信息存在 |
| 47 | if !strings.Contains(systemPrompt, "## Environment Information") { |
| 48 | t.Error("System prompt should contain environment information") |
| 49 | } |
| 50 | |
| 51 | // 验证工具手册存在 |
| 52 | if !strings.Contains(systemPrompt, "## Tools Manual") { |
| 53 | t.Error("System prompt should contain tools manual") |
| 54 | } |
| 55 | |
| 56 | t.Logf("System Prompt length: %d", len(systemPrompt)) |
| 57 | } |
| 58 | |
| 59 | func TestPromptBuilder_CodeAssistant(t *testing.T) { |
| 60 | deps := setupPromptTestDeps(t) |
nothing calls this directly
no test coverage detected