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

Function TestBashToolsMergeCustomWithDefaults

pkg/workflow/bash_merge_test.go:10–135  ·  view source on GitHub ↗

TestBashToolsMergeCustomWithDefaults tests that custom bash tools get merged with defaults

(t *testing.T)

Source from the content-addressed store, hash-verified

8
9// TestBashToolsMergeCustomWithDefaults tests that custom bash tools get merged with defaults
10func TestBashToolsMergeCustomWithDefaults(t *testing.T) {
11 compiler := NewCompiler()
12
13 tests := []struct {
14 name string
15 tools map[string]any
16 safeOutputs *SafeOutputsConfig
17 expected []string
18 }{
19 {
20 name: "bash with make commands should include defaults + make",
21 tools: map[string]any{
22 "bash": []any{"make:*"},
23 },
24 safeOutputs: nil,
25 expected: []string{"echo", "printf", "ls", "pwd", "cat", "head", "tail", "grep", "wc", "sort", "uniq", "date", "yq", "make:*"},
26 },
27 {
28 name: "bash: true should be converted to wildcard",
29 tools: map[string]any{
30 "bash": true,
31 },
32 safeOutputs: nil,
33 expected: []string{"*"},
34 },
35 {
36 name: "bash: false should be removed",
37 tools: map[string]any{
38 "bash": false,
39 },
40 safeOutputs: nil,
41 expected: nil, // bash should not exist
42 },
43 {
44 name: "bash: true with safe outputs should use wildcard (not add git commands)",
45 tools: map[string]any{
46 "bash": true,
47 },
48 safeOutputs: &SafeOutputsConfig{
49 CreatePullRequests: &CreatePullRequestsConfig{},
50 },
51 expected: []string{"*"},
52 },
53 {
54 name: "bash with multiple commands should include defaults + custom",
55 tools: map[string]any{
56 "bash": []any{"make:*", "npm:*"},
57 },
58 safeOutputs: nil,
59 expected: []string{"echo", "printf", "ls", "pwd", "cat", "head", "tail", "grep", "wc", "sort", "uniq", "date", "yq", "make:*", "npm:*"},
60 },
61 {
62 name: "bash with empty array should remain empty",
63 tools: map[string]any{
64 "bash": []any{},
65 },
66 safeOutputs: nil,
67 expected: []string{},

Callers

nothing calls this directly

Calls 4

applyDefaultToolsMethod · 0.95
NewCompilerFunction · 0.85
RunMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected