MCPcopy Create free account
hub / github.com/aurora-develop/aurora / TestRecoverFromTextShellFallback

Function TestRecoverFromTextShellFallback

internal/toolcall/parser_test.go:236–252  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

234}
235
236func TestRecoverFromTextShellFallback(t *testing.T) {
237 tools := []official.Tool{
238 {Type: "function", Function: official.ToolFunction{Name: "bash", Parameters: json.RawMessage(`{"properties":{"command":{"type":"string"}}}`)}},
239 }
240 // 模型输出沙箱格式
241 text := `{"cmd": ["powershell", "-Command", "Get-Process"]}`
242 calls := RecoverFromText(text, tools)
243 if len(calls) != 1 {
244 t.Fatalf("calls = %d", len(calls))
245 }
246 if calls[0].Function.Name != "bash" {
247 t.Fatalf("name = %q", calls[0].Function.Name)
248 }
249 if !strings.Contains(calls[0].Function.Arguments, "Get-Process") {
250 t.Fatalf("args = %q", calls[0].Function.Arguments)
251 }
252}
253
254func TestRecoverFromTextDeduplicates(t *testing.T) {
255 tools := []official.Tool{

Callers

nothing calls this directly

Calls 1

RecoverFromTextFunction · 0.85

Tested by

no test coverage detected