mirror of
https://github.com/CJackHwang/ds2api.git
synced 2026-05-06 09:25:27 +08:00
27 lines
954 B
Go
27 lines
954 B
Go
package toolcall
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestBuildToolCallInstructions_ExecCommandUsesCmdExample(t *testing.T) {
|
|
out := BuildToolCallInstructions([]string{"exec_command"})
|
|
if !strings.Contains(out, `<tool_name>exec_command</tool_name>`) {
|
|
t.Fatalf("expected exec_command in examples, got: %s", out)
|
|
}
|
|
if !strings.Contains(out, `<parameters><cmd><![CDATA[pwd]]></cmd></parameters>`) {
|
|
t.Fatalf("expected cmd parameter example for exec_command, got: %s", out)
|
|
}
|
|
}
|
|
|
|
func TestBuildToolCallInstructions_ExecuteCommandUsesCommandExample(t *testing.T) {
|
|
out := BuildToolCallInstructions([]string{"execute_command"})
|
|
if !strings.Contains(out, `<tool_name>execute_command</tool_name>`) {
|
|
t.Fatalf("expected execute_command in examples, got: %s", out)
|
|
}
|
|
if !strings.Contains(out, `<parameters><command><![CDATA[pwd]]></command></parameters>`) {
|
|
t.Fatalf("expected command parameter example for execute_command, got: %s", out)
|
|
}
|
|
}
|