Reformat
This commit is contained in:
@@ -7,49 +7,41 @@
|
||||
#include <string.h>
|
||||
|
||||
TestFuncResult test_commander_cmd_success(void) {
|
||||
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_DISCARD, NULL, 0,
|
||||
"echo", "hello world");
|
||||
|
||||
bool succeeded = result.exited && result.exit_code == EXIT_SUCCESS &&
|
||||
result.error == SHELL_ERR_NO_ERROR;
|
||||
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_DISCARD, NULL, 0, "echo", "hello world");
|
||||
bool succeeded = result.exited && result.exit_code == EXIT_SUCCESS &&
|
||||
result.error == SHELL_ERR_NO_ERROR;
|
||||
|
||||
return wapp_tester_result(succeeded);
|
||||
}
|
||||
|
||||
TestFuncResult test_commander_cmd_failure(void) {
|
||||
CMDResult result =
|
||||
wapp_shell_commander_execute(SHELL_OUTPUT_DISCARD, NULL, 0, "grep");
|
||||
|
||||
bool failed = result.exited && result.exit_code != EXIT_SUCCESS &&
|
||||
result.error == SHELL_ERR_NO_ERROR;
|
||||
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_DISCARD, NULL, 0, "grep");
|
||||
bool failed = result.exited && result.exit_code != EXIT_SUCCESS &&
|
||||
result.error == SHELL_ERR_NO_ERROR;
|
||||
|
||||
return wapp_tester_result(failed);
|
||||
}
|
||||
|
||||
TestFuncResult test_commander_cmd_out_buf_success(void) {
|
||||
char buf[64] = {0};
|
||||
char buf[64] = {0};
|
||||
char expected_output[64] = {0};
|
||||
const char *msg = "hello world";
|
||||
const char *msg = "hello world";
|
||||
sprintf(expected_output, "%s\n", msg);
|
||||
|
||||
CMDResult result =
|
||||
wapp_shell_commander_execute(SHELL_OUTPUT_CAPTURE, buf, 64, "echo", msg);
|
||||
|
||||
bool succeeded = result.exited && result.exit_code == EXIT_SUCCESS &&
|
||||
result.error == SHELL_ERR_NO_ERROR &&
|
||||
strcmp(buf, expected_output) == 0;
|
||||
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_CAPTURE, buf, 64, "echo", msg);
|
||||
bool succeeded = result.exited && result.exit_code == EXIT_SUCCESS &&
|
||||
result.error == SHELL_ERR_NO_ERROR &&
|
||||
strcmp(buf, expected_output) == 0;
|
||||
|
||||
return wapp_tester_result(succeeded);
|
||||
}
|
||||
|
||||
TestFuncResult test_commander_cmd_out_buf_failure(void) {
|
||||
char buf[4] = {0};
|
||||
const char *msg = "hello world";
|
||||
CMDResult result =
|
||||
wapp_shell_commander_execute(SHELL_OUTPUT_CAPTURE, buf, 4, "echo", msg);
|
||||
|
||||
bool failed = !result.exited && result.exit_code != EXIT_SUCCESS &&
|
||||
result.error == SHELL_ERR_OUT_BUF_FULL && strcmp(buf, msg) != 0;
|
||||
char buf[4] = {0};
|
||||
const char *msg = "hello world";
|
||||
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_CAPTURE, buf, 4, "echo", msg);
|
||||
bool failed = !result.exited && result.exit_code != EXIT_SUCCESS &&
|
||||
result.error == SHELL_ERR_OUT_BUF_FULL && strcmp(buf, msg) != 0;
|
||||
|
||||
return wapp_tester_result(failed);
|
||||
}
|
||||
|
Reference in New Issue
Block a user