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

Function TestExtractAddDirPaths

pkg/workflow/copilot_engine_test.go:1692–1746  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1690}
1691
1692func TestExtractAddDirPaths(t *testing.T) {
1693 tests := []struct {
1694 name string
1695 args []string
1696 expected []string
1697 }{
1698 {
1699 name: "empty args",
1700 args: []string{},
1701 expected: []string{},
1702 },
1703 {
1704 name: "no add-dir flags",
1705 args: []string{"--log-level", "debug", "--model", "gpt-4"},
1706 expected: []string{},
1707 },
1708 {
1709 name: "single add-dir",
1710 args: []string{"--add-dir", "/tmp/"},
1711 expected: []string{"/tmp/"},
1712 },
1713 {
1714 name: "multiple add-dir flags",
1715 args: []string{"--add-dir", "/tmp/", "--log-level", "debug", "--add-dir", "/tmp/gh-aw/"},
1716 expected: []string{"/tmp/", "/tmp/gh-aw/"},
1717 },
1718 {
1719 name: "add-dir at end of args",
1720 args: []string{"--log-level", "debug", "--add-dir", "/tmp/gh-aw/agent/"},
1721 expected: []string{"/tmp/gh-aw/agent/"},
1722 },
1723 {
1724 name: "all default copilot args",
1725 args: []string{"--add-dir", "/tmp/", "--add-dir", "/tmp/gh-aw/", "--add-dir", "/tmp/gh-aw/agent/", "--log-level", "all", "--log-dir", "/tmp/gh-aw/sandbox/agent/logs/"},
1726 expected: []string{"/tmp/", "/tmp/gh-aw/", "/tmp/gh-aw/agent/"},
1727 },
1728 }
1729
1730 for _, tt := range tests {
1731 t.Run(tt.name, func(t *testing.T) {
1732 result := extractAddDirPaths(tt.args)
1733
1734 if len(result) != len(tt.expected) {
1735 t.Errorf("Expected %d paths, got %d: %v", len(tt.expected), len(result), result)
1736 return
1737 }
1738
1739 for i, expected := range tt.expected {
1740 if i >= len(result) || result[i] != expected {
1741 t.Errorf("Expected path %d to be '%s', got '%s'", i, expected, result[i])
1742 }
1743 }
1744 })
1745 }
1746}
1747
1748func TestCopilotEngineExecutionStepsWithCacheMemory(t *testing.T) {
1749 engine := NewCopilotEngine()

Callers

nothing calls this directly

Calls 3

extractAddDirPathsFunction · 0.85
RunMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected