Switch to using tabs instead of spaces (#9)

Reviewed-on: #9
This commit was merged in pull request #9.
This commit is contained in:
2025-12-29 22:46:52 +00:00
parent aa6ef1ec2c
commit ad2de98093
60 changed files with 3772 additions and 3772 deletions

View File

@@ -5,58 +5,58 @@
#include <string.h>
TestFuncResult test_commander_cmd_success(void) {
Str8List cmd = wapp_dbl_list(Str8, Str8List);
wapp_dbl_list_push_back(Str8, &cmd, &wapp_str8_node_from_cstr("echo"));
wapp_dbl_list_push_back(Str8, &cmd, &wapp_str8_node_from_cstr("hello world"));
Str8List cmd = wapp_dbl_list(Str8, Str8List);
wapp_dbl_list_push_back(Str8, &cmd, &wapp_str8_node_from_cstr("echo"));
wapp_dbl_list_push_back(Str8, &cmd, &wapp_str8_node_from_cstr("hello world"));
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_DISCARD, NULL, &cmd);
b8 succeeded = result.exited && result.exit_code == EXIT_SUCCESS &&
result.error == SHELL_ERR_NO_ERROR;
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_DISCARD, NULL, &cmd);
b8 succeeded = result.exited && result.exit_code == EXIT_SUCCESS &&
result.error == SHELL_ERR_NO_ERROR;
return wapp_tester_result(succeeded);
return wapp_tester_result(succeeded);
}
TestFuncResult test_commander_cmd_failure(void) {
Str8List cmd = wapp_dbl_list(Str8, Str8List);
wapp_dbl_list_push_back(Str8, &cmd, &wapp_str8_node_from_cstr("grep"));
Str8List cmd = wapp_dbl_list(Str8, Str8List);
wapp_dbl_list_push_back(Str8, &cmd, &wapp_str8_node_from_cstr("grep"));
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_DISCARD, NULL, &cmd);
b8 failed = result.exited && result.exit_code != EXIT_SUCCESS &&
result.error == SHELL_ERR_NO_ERROR;
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_DISCARD, NULL, &cmd);
b8 failed = result.exited && result.exit_code != EXIT_SUCCESS &&
result.error == SHELL_ERR_NO_ERROR;
return wapp_tester_result(failed);
return wapp_tester_result(failed);
}
TestFuncResult test_commander_cmd_out_buf_success(void) {
Str8 buf = wapp_str8_buf(64);
Str8 expected = wapp_str8_buf(64);
char msg[] = "hello world";
wapp_str8_copy_cstr_capped(&expected, msg);
Str8 buf = wapp_str8_buf(64);
Str8 expected = wapp_str8_buf(64);
char msg[] = "hello world";
wapp_str8_copy_cstr_capped(&expected, msg);
Str8List cmd = wapp_dbl_list(Str8, Str8List);
wapp_dbl_list_push_back(Str8, &cmd, &wapp_str8_node_from_cstr("echo"));
wapp_dbl_list_push_back(Str8, &cmd, &wapp_str8_node_from_cstr(msg));
Str8List cmd = wapp_dbl_list(Str8, Str8List);
wapp_dbl_list_push_back(Str8, &cmd, &wapp_str8_node_from_cstr("echo"));
wapp_dbl_list_push_back(Str8, &cmd, &wapp_str8_node_from_cstr(msg));
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_CAPTURE, &buf, &cmd);
b8 succeeded = result.exited && result.exit_code == EXIT_SUCCESS &&
result.error == SHELL_ERR_NO_ERROR && wapp_str8_equal_to_count(&buf, &expected, strlen(msg));
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_CAPTURE, &buf, &cmd);
b8 succeeded = result.exited && result.exit_code == EXIT_SUCCESS &&
result.error == SHELL_ERR_NO_ERROR && wapp_str8_equal_to_count(&buf, &expected, strlen(msg));
return wapp_tester_result(succeeded);
return wapp_tester_result(succeeded);
}
TestFuncResult test_commander_cmd_out_buf_failure(void) {
Str8 buf = wapp_str8_buf(4);
Str8 expected = wapp_str8_buf(64);
char msg[] = "hello world";
wapp_str8_copy_cstr_capped(&expected, msg);
Str8 buf = wapp_str8_buf(4);
Str8 expected = wapp_str8_buf(64);
char msg[] = "hello world";
wapp_str8_copy_cstr_capped(&expected, msg);
Str8List cmd = wapp_dbl_list(Str8, Str8List);
wapp_dbl_list_push_back(Str8, &cmd, &wapp_str8_node_from_cstr("echo"));
wapp_dbl_list_push_back(Str8, &cmd, &wapp_str8_node_from_cstr(msg));
Str8List cmd = wapp_dbl_list(Str8, Str8List);
wapp_dbl_list_push_back(Str8, &cmd, &wapp_str8_node_from_cstr("echo"));
wapp_dbl_list_push_back(Str8, &cmd, &wapp_str8_node_from_cstr(msg));
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_CAPTURE, &buf, &cmd);
b8 failed = !result.exited && result.exit_code != EXIT_SUCCESS &&
result.error == SHELL_ERR_OUT_BUF_FULL && !wapp_str8_equal(&buf, &expected);
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_CAPTURE, &buf, &cmd);
b8 failed = !result.exited && result.exit_code != EXIT_SUCCESS &&
result.error == SHELL_ERR_OUT_BUF_FULL && !wapp_str8_equal(&buf, &expected);
return wapp_tester_result(failed);
return wapp_tester_result(failed);
}

View File

@@ -5,65 +5,65 @@
#include <string.h>
TestFuncResult test_commander_cmd_success(void) {
Str8List cmd = wapp_dbl_list(Str8, Str8List);
Str8Node echo = wapp_str8_node_from_cstr("echo");
Str8Node msg = wapp_str8_node_from_cstr("hello world");
wapp_dbl_list_push_back(Str8, &cmd, &echo);
wapp_dbl_list_push_back(Str8, &cmd, &msg);
Str8List cmd = wapp_dbl_list(Str8, Str8List);
Str8Node echo = wapp_str8_node_from_cstr("echo");
Str8Node msg = wapp_str8_node_from_cstr("hello world");
wapp_dbl_list_push_back(Str8, &cmd, &echo);
wapp_dbl_list_push_back(Str8, &cmd, &msg);
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_DISCARD, nullptr, &cmd);
b8 succeeded = result.exited && result.exit_code == EXIT_SUCCESS &&
result.error == SHELL_ERR_NO_ERROR;
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_DISCARD, nullptr, &cmd);
b8 succeeded = result.exited && result.exit_code == EXIT_SUCCESS &&
result.error == SHELL_ERR_NO_ERROR;
return wapp_tester_result(succeeded);
return wapp_tester_result(succeeded);
}
TestFuncResult test_commander_cmd_failure(void) {
Str8List cmd = wapp_dbl_list(Str8, Str8List);
Str8Node grep = wapp_str8_node_from_cstr("grep");
wapp_dbl_list_push_back(Str8, &cmd, &grep);
Str8List cmd = wapp_dbl_list(Str8, Str8List);
Str8Node grep = wapp_str8_node_from_cstr("grep");
wapp_dbl_list_push_back(Str8, &cmd, &grep);
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_DISCARD, nullptr, &cmd);
b8 failed = result.exited && result.exit_code != EXIT_SUCCESS &&
result.error == SHELL_ERR_NO_ERROR;
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_DISCARD, nullptr, &cmd);
b8 failed = result.exited && result.exit_code != EXIT_SUCCESS &&
result.error == SHELL_ERR_NO_ERROR;
return wapp_tester_result(failed);
return wapp_tester_result(failed);
}
TestFuncResult test_commander_cmd_out_buf_success(void) {
Str8 buf = wapp_str8_buf(64);
Str8 expected = wapp_str8_buf(64);
char msg[] = "hello world";
wapp_str8_copy_cstr_capped(&expected, msg);
Str8 buf = wapp_str8_buf(64);
Str8 expected = wapp_str8_buf(64);
char msg[] = "hello world";
wapp_str8_copy_cstr_capped(&expected, msg);
Str8List cmd = wapp_dbl_list(Str8, Str8List);
Str8Node echo = wapp_str8_node_from_cstr("echo");
Str8Node arg = wapp_str8_node_from_cstr(msg);
wapp_dbl_list_push_back(Str8, &cmd, &echo);
wapp_dbl_list_push_back(Str8, &cmd, &arg);
Str8List cmd = wapp_dbl_list(Str8, Str8List);
Str8Node echo = wapp_str8_node_from_cstr("echo");
Str8Node arg = wapp_str8_node_from_cstr(msg);
wapp_dbl_list_push_back(Str8, &cmd, &echo);
wapp_dbl_list_push_back(Str8, &cmd, &arg);
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_CAPTURE, &buf, &cmd);
b8 succeeded = result.exited && result.exit_code == EXIT_SUCCESS &&
result.error == SHELL_ERR_NO_ERROR && wapp_str8_equal_to_count(&buf, &expected, strlen(msg));
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_CAPTURE, &buf, &cmd);
b8 succeeded = result.exited && result.exit_code == EXIT_SUCCESS &&
result.error == SHELL_ERR_NO_ERROR && wapp_str8_equal_to_count(&buf, &expected, strlen(msg));
return wapp_tester_result(succeeded);
return wapp_tester_result(succeeded);
}
TestFuncResult test_commander_cmd_out_buf_failure(void) {
Str8 buf = wapp_str8_buf(4);
Str8 expected = wapp_str8_buf(64);
char msg[] = "hello world";
wapp_str8_copy_cstr_capped(&expected, msg);
Str8 buf = wapp_str8_buf(4);
Str8 expected = wapp_str8_buf(64);
char msg[] = "hello world";
wapp_str8_copy_cstr_capped(&expected, msg);
Str8List cmd = wapp_dbl_list(Str8, Str8List);
Str8Node echo = wapp_str8_node_from_cstr("echo");
Str8Node arg = wapp_str8_node_from_cstr(msg);
wapp_dbl_list_push_back(Str8, &cmd, &echo);
wapp_dbl_list_push_back(Str8, &cmd, &arg);
Str8List cmd = wapp_dbl_list(Str8, Str8List);
Str8Node echo = wapp_str8_node_from_cstr("echo");
Str8Node arg = wapp_str8_node_from_cstr(msg);
wapp_dbl_list_push_back(Str8, &cmd, &echo);
wapp_dbl_list_push_back(Str8, &cmd, &arg);
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_CAPTURE, &buf, &cmd);
b8 failed = !result.exited && result.exit_code != EXIT_SUCCESS &&
result.error == SHELL_ERR_OUT_BUF_FULL && !wapp_str8_equal(&buf, &expected);
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_CAPTURE, &buf, &cmd);
b8 failed = !result.exited && result.exit_code != EXIT_SUCCESS &&
result.error == SHELL_ERR_OUT_BUF_FULL && !wapp_str8_equal(&buf, &expected);
return wapp_tester_result(failed);
return wapp_tester_result(failed);
}