MCPcopy Create free account
hub / github.com/github/gh-aw / TestComputeBashCommandsDiff_PerCommandTracking

Function TestComputeBashCommandsDiff_PerCommandTracking

pkg/cli/audit_diff_test.go:1291–1321  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1289}
1290
1291func TestComputeBashCommandsDiff_PerCommandTracking(t *testing.T) {
1292 // Codex-style per-command bash tracking
1293 run1Tools := map[string]ToolCallInfo{
1294 "bash_git_status": {Name: "bash_git_status", CallCount: 3},
1295 "bash_ls_la": {Name: "bash_ls_la", CallCount: 1},
1296 "bash_cat_readme": {Name: "bash_cat_readme", CallCount: 2},
1297 }
1298 run2Tools := map[string]ToolCallInfo{
1299 "bash_git_status": {Name: "bash_git_status", CallCount: 5},
1300 "bash_git_diff": {Name: "bash_git_diff", CallCount: 4},
1301 "bash_cat_readme": {Name: "bash_cat_readme", CallCount: 2},
1302 }
1303
1304 result := computeBashCommandsDiff(run1Tools, run2Tools)
1305 require.NotNil(t, result, "Should produce bash diff")
1306
1307 assert.Equal(t, 6, result.Run1TotalCalls, "Run1 total: 3+1+2=6")
1308 assert.Equal(t, 11, result.Run2TotalCalls, "Run2 total: 5+4+2=11")
1309 assert.Equal(t, "+5", result.TotalCallsChange, "Total change should be +5")
1310
1311 require.Len(t, result.Commands, 4, "Should have 4 commands (ls removed, diff added, status/cat changed/unchanged)")
1312
1313 statusMap := make(map[string]string)
1314 for _, cmd := range result.Commands {
1315 statusMap[cmd.Name] = cmd.Status
1316 }
1317 assert.Equal(t, "changed", statusMap["bash_git_status"], "git_status should be changed")
1318 assert.Equal(t, "removed", statusMap["bash_ls_la"], "ls_la should be removed")
1319 assert.Equal(t, "unchanged", statusMap["bash_cat_readme"], "cat_readme should be unchanged")
1320 assert.Equal(t, "new", statusMap["bash_git_diff"], "git_diff should be new")
1321}
1322
1323func TestComputeBashCommandsDiff_BashCapitalized(t *testing.T) {
1324 // Claude uses "Bash" (capitalized)

Callers

nothing calls this directly

Calls 1

computeBashCommandsDiffFunction · 0.85

Tested by

no test coverage detected