MCPcopy Index your code
hub / github.com/1Password/for-open-source / setupTestDir

Function setupTestDir

script/application_test.go:9–24  ·  view source on GitHub ↗
(targetDir string)

Source from the content-addressed store, hash-verified

7)
8
9func setupTestDir(targetDir string) (cleanupFunc func(), err error) {
10 originalDir, err := os.Getwd()
11 if err != nil {
12 return nil, fmt.Errorf("failed to get current directory: %s", err)
13 }
14
15 if err := os.Chdir(targetDir); err != nil {
16 return nil, fmt.Errorf("failed to change working directory: %s", err)
17 }
18
19 return func() {
20 if err := os.Chdir(originalDir); err != nil {
21 fmt.Printf("Failed to change back to original directory: %s\n", err)
22 }
23 }, nil
24}
25
26func errNoProjectName(sectionTitle string) error {
27 return fmt.Errorf("**%s** is missing project name", sectionTitle)

Callers 2

TestApplication_ParseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected