selectScripts returns the script files under testdata/command that match the requested names, and reports whether a filter was applied (i.e. scripts is non-empty). A named script not found in the directory is silently ignored because it belongs to another command directory in the same run.
(command string, scripts []string)
| 23 | // non-empty). A named script not found in the directory is silently ignored |
| 24 | // because it belongs to another command directory in the same run. |
| 25 | func selectScripts(command string, scripts []string) (files []string, filtered bool) { |
| 26 | if len(scripts) == 0 { |
| 27 | return nil, false |
| 28 | } |
| 29 | for _, script := range scripts { |
| 30 | p := path.Join("testdata", command, script) |
| 31 | if _, err := os.Stat(p); err == nil { |
| 32 | files = append(files, p) |
| 33 | } |
| 34 | } |
| 35 | return files, true |
| 36 | } |
no test coverage detected