(t *testing.T, command string, expected string)
| 154 | } |
| 155 | |
| 156 | func MainParsesBuiltInDefinitions(t *testing.T, command string, expected string) { |
| 157 | definitionDir, _ := os.Getwd() |
| 158 | t.Setenv("UIPATH_DEFINITIONS_PATH", filepath.Join(definitionDir, "definitions/")) |
| 159 | |
| 160 | os.Args = strings.Split("uipath "+command, " ") |
| 161 | output := captureOutput(t, func() { |
| 162 | main() |
| 163 | }) |
| 164 | |
| 165 | if !strings.Contains(output, expected) { |
| 166 | t.Errorf("Expected %s in output, but got: %v", expected, output) |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | func captureOutput(t *testing.T, runnable func()) string { |
| 171 | realStdout := os.Stdout |
no test coverage detected