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

Function TestParserStreamingChunked

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

Source from the content-addressed store, hash-verified

26}
27
28func TestParserStreamingChunked(t *testing.T) {
29 p := NewParser()
30 // 模型分段发出
31 segments := []string{
32 "让我先",
33 "查一下文件:",
34 "<tool_call>",
35 `{"name": "bash",`,
36 ` "arguments": {"command": "ls"}}`,
37 "</tool_call>",
38 " ",
39 }
40 var allText string
41 var allCalls []official.ToolCall
42 for _, s := range segments {
43 txt, calls := p.Feed(s)
44 allText += txt
45 allCalls = append(allCalls, calls...)
46 }
47 if allText != "让我先查一下文件: " {
48 t.Fatalf("concatenated text = %q", allText)
49 }
50 if len(allCalls) != 1 {
51 t.Fatalf("calls = %d", len(allCalls))
52 }
53 if allCalls[0].Function.Name != "bash" {
54 t.Fatalf("name = %q", allCalls[0].Function.Name)
55 }
56}
57
58func TestParserMultipleCalls(t *testing.T) {
59 p := NewParser()

Callers

nothing calls this directly

Calls 2

FeedMethod · 0.95
NewParserFunction · 0.85

Tested by

no test coverage detected