Skip to content

Commit 8114bad

Browse files
committed
feat: assert extracted tool calls
1 parent a06902b commit 8114bad

2 files changed

Lines changed: 39 additions & 1 deletion

File tree

lib/msgfmt/msgfmt_test.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,16 @@ func TestFormatAgentMessage(t *testing.T) {
233233
assert.NoError(t, err)
234234
expected, err := testdataDir.ReadFile(path.Join(dir, string(agentType), c.Name(), "expected.txt"))
235235
assert.NoError(t, err)
236-
output, _ := FormatToolCall(agentType, FormatAgentMessage(agentType, string(msg), string(userInput)))
236+
output, toolCalls := FormatToolCall(agentType, FormatAgentMessage(agentType, string(msg), string(userInput)))
237237
assert.Equal(t, string(expected), output)
238+
239+
// Assert on the tool calls if there's an expected file
240+
expectedToolCallsPath := path.Join(dir, string(agentType), c.Name(), "expected_tool_calls.txt")
241+
if expectedToolCallsData, err := testdataDir.ReadFile(expectedToolCallsPath); err == nil {
242+
expectedToolCalls := string(expectedToolCallsData)
243+
actualToolCalls := strings.Join(toolCalls, "\n---\n")
244+
assert.Equal(t, expectedToolCalls, actualToolCalls)
245+
}
238246
})
239247
}
240248
})
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
● coder - coder_report_task (MCP)(summary: "Snake game created
2+
successfully at snake-game.html",
3+
link: "file:///home/coder/snake-ga
4+
me.html", state: "working")
5+
⎿ {
6+
"message": "Thanks for reporting!"
7+
}
8+
---
9+
● coder - coder_report_task (MCP)(summary: "Snake game created
10+
successfully at snake-game.html",
11+
link: "file:///home/coder/snake-ga
12+
me.html", state: "working")
13+
⎿ {
14+
"message": "Thanks for reporting!"
15+
}
16+
---
17+
● coder - coder_report_task (MCP)(summary: "Building a snake game
18+
with HTML/CSS/JavaScript", link:
19+
"", state: "working")
20+
⎿ {
21+
"message": "Thanks for reporting!"
22+
}
23+
---
24+
● coder - coder_report_task (MCP)(summary: "Snake game created
25+
successfully at snake-game.html",
26+
link: "file:///home/coder/snake-ga
27+
me.html", state: "working")
28+
⎿ {
29+
"message": "Thanks for reporting!"
30+
}

0 commit comments

Comments
 (0)