mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-04-13 05:37:29 +08:00
35 lines
1.1 KiB
Go
35 lines
1.1 KiB
Go
package tools
|
|
|
|
import "testing"
|
|
|
|
func TestExpandToolAllowlistEntries_GroupPrefix(t *testing.T) {
|
|
got := ExpandToolAllowlistEntries([]string{"group:files_read"})
|
|
contains := map[string]bool{}
|
|
for _, item := range got {
|
|
contains[item] = true
|
|
}
|
|
if !contains["read_file"] || !contains["list_dir"] {
|
|
t.Fatalf("files_read group expansion missing expected tools: %v", got)
|
|
}
|
|
if contains["write_file"] {
|
|
t.Fatalf("files_read group should not include write_file: %v", got)
|
|
}
|
|
}
|
|
|
|
func TestExpandToolAllowlistEntries_BareGroupAndAlias(t *testing.T) {
|
|
got := ExpandToolAllowlistEntries([]string{"memory_all", "@subagents", "skill"})
|
|
contains := map[string]bool{}
|
|
for _, item := range got {
|
|
contains[item] = true
|
|
}
|
|
if !contains["memory_search"] || !contains["memory_write"] {
|
|
t.Fatalf("memory_all expansion missing memory tools: %v", got)
|
|
}
|
|
if !contains["spawn"] || !contains["subagents"] || !contains["subagent_profile"] {
|
|
t.Fatalf("subagents alias expansion missing subagent tools: %v", got)
|
|
}
|
|
if !contains["skill_exec"] {
|
|
t.Fatalf("skills alias expansion missing skill_exec: %v", got)
|
|
}
|
|
}
|