MCPcopy Create free account
hub / github.com/UiPath/uipathcli / MainParsesBuiltInDefinitions

Function MainParsesBuiltInDefinitions

main_test.go:156–168  ·  view source on GitHub ↗
(t *testing.T, command string, expected string)

Source from the content-addressed store, hash-verified

154}
155
156func 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
170func captureOutput(t *testing.T, runnable func()) string {
171 realStdout := os.Stdout

Callers 1

Calls 2

captureOutputFunction · 0.85
mainFunction · 0.50

Tested by

no test coverage detected