@@ -1901,3 +1901,52 @@ func TestProcessToolCalls_UsesPinnedAgent(t *testing.T) {
19011901 }
19021902 }
19031903}
1904+
1905+ func TestFilterExcludedTools (t * testing.T ) {
1906+ allTools := []tools.Tool {
1907+ {Name : "read_skill" },
1908+ {Name : "run_skill" },
1909+ {Name : "shell" },
1910+ }
1911+
1912+ t .Run ("no exclusions returns all tools" , func (t * testing.T ) {
1913+ result := filterExcludedTools (allTools , nil )
1914+ assert .Len (t , result , 3 )
1915+ })
1916+
1917+ t .Run ("excludes run_skill" , func (t * testing.T ) {
1918+ result := filterExcludedTools (allTools , []string {"run_skill" })
1919+ assert .Len (t , result , 2 )
1920+ for _ , tool := range result {
1921+ assert .NotEqual (t , "run_skill" , tool .Name )
1922+ }
1923+ })
1924+
1925+ t .Run ("excludes multiple tools" , func (t * testing.T ) {
1926+ result := filterExcludedTools (allTools , []string {"run_skill" , "shell" })
1927+ assert .Len (t , result , 1 )
1928+ assert .Equal (t , "read_skill" , result [0 ].Name )
1929+ })
1930+ }
1931+
1932+ func TestMergeExcludedTools (t * testing.T ) {
1933+ t .Run ("both empty" , func (t * testing.T ) {
1934+ assert .Nil (t , mergeExcludedTools (nil , nil ))
1935+ })
1936+
1937+ t .Run ("parent only" , func (t * testing.T ) {
1938+ result := mergeExcludedTools ([]string {"run_skill" }, nil )
1939+ assert .Equal (t , []string {"run_skill" }, result )
1940+ })
1941+
1942+ t .Run ("child only" , func (t * testing.T ) {
1943+ result := mergeExcludedTools (nil , []string {"run_skill" })
1944+ assert .Equal (t , []string {"run_skill" }, result )
1945+ })
1946+
1947+ t .Run ("deduplicates" , func (t * testing.T ) {
1948+ result := mergeExcludedTools ([]string {"run_skill" , "shell" }, []string {"run_skill" , "read_skill" })
1949+ assert .Len (t , result , 3 )
1950+ assert .ElementsMatch (t , []string {"run_skill" , "shell" , "read_skill" }, result )
1951+ })
1952+ }
0 commit comments