Rename Str8

This commit is contained in:
2026-06-26 16:18:46 +01:00
parent acbfc9088c
commit e2b57d4aba
23 changed files with 867 additions and 867 deletions
+15 -15
View File
@@ -6,8 +6,8 @@
WpTestFuncResult test_commander_cmd_success(void) {
WpStr8List cmd = wapp_dbl_list(WpStr8);
wapp_dbl_list_push_back(WpStr8, &cmd, &wapp_str8_lit("echo"));
wapp_dbl_list_push_back(WpStr8, &cmd, &wapp_str8_lit("hello world"));
wapp_dbl_list_push_back(WpStr8, &cmd, &wpStr8Lit("echo"));
wapp_dbl_list_push_back(WpStr8, &cmd, &wpStr8Lit("hello world"));
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_DISCARD, NULL, &cmd);
b8 succeeded = result.exited && result.exit_code == EXIT_SUCCESS &&
@@ -18,7 +18,7 @@ WpTestFuncResult test_commander_cmd_success(void) {
WpTestFuncResult test_commander_cmd_failure(void) {
WpStr8List cmd = wapp_dbl_list(WpStr8);
wapp_dbl_list_push_back(WpStr8, &cmd, &wapp_str8_lit("grep"));
wapp_dbl_list_push_back(WpStr8, &cmd, &wpStr8Lit("grep"));
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_DISCARD, NULL, &cmd);
b8 failed = result.exited && result.exit_code != EXIT_SUCCESS &&
@@ -28,35 +28,35 @@ WpTestFuncResult test_commander_cmd_failure(void) {
}
WpTestFuncResult test_commander_cmd_out_buf_success(void) {
WpStr8 buf = wapp_str8_buf(64);
WpStr8 expected = wapp_str8_buf(64);
WpStr8 buf = wpStr8Buf(64);
WpStr8 expected = wpStr8Buf(64);
char msg[] = "hello world";
wapp_str8_copy_cstr_capped(&expected, msg);
wpStr8CopyCstrCapped(&expected, msg);
WpStr8List cmd = wapp_dbl_list(WpStr8);
wapp_dbl_list_push_back(WpStr8, &cmd, &wapp_str8_lit("echo"));
wapp_dbl_list_push_back(WpStr8, &cmd, &wapp_str8_lit(msg));
wapp_dbl_list_push_back(WpStr8, &cmd, &wpStr8Lit("echo"));
wapp_dbl_list_push_back(WpStr8, &cmd, &wpStr8Lit(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));
result.error == SHELL_ERR_NO_ERROR && wpStr8EqualToCount(&buf, &expected, strlen(msg));
return wpTesterResult(succeeded);
}
WpTestFuncResult test_commander_cmd_out_buf_failure(void) {
WpStr8 buf = wapp_str8_buf(4);
WpStr8 expected = wapp_str8_buf(64);
WpStr8 buf = wpStr8Buf(4);
WpStr8 expected = wpStr8Buf(64);
char msg[] = "hello world";
wapp_str8_copy_cstr_capped(&expected, msg);
wpStr8CopyCstrCapped(&expected, msg);
WpStr8List cmd = wapp_dbl_list(WpStr8);
wapp_dbl_list_push_back(WpStr8, &cmd, &wapp_str8_lit("echo"));
wapp_dbl_list_push_back(WpStr8, &cmd, &wapp_str8_lit(msg));
wapp_dbl_list_push_back(WpStr8, &cmd, &wpStr8Lit("echo"));
wapp_dbl_list_push_back(WpStr8, &cmd, &wpStr8Lit(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);
result.error == SHELL_ERR_OUT_BUF_FULL && !wpStr8Equal(&buf, &expected);
return wpTesterResult(failed);
}
+15 -15
View File
@@ -6,8 +6,8 @@
WpTestFuncResult test_commander_cmd_success(void) {
WpStr8List cmd = wapp_dbl_list(WpStr8);
WpStr8 echo = wapp_str8_lit("echo");
WpStr8 msg = wapp_str8_lit("hello world");
WpStr8 echo = wpStr8Lit("echo");
WpStr8 msg = wpStr8Lit("hello world");
wapp_dbl_list_push_back(WpStr8, &cmd, &echo);
wapp_dbl_list_push_back(WpStr8, &cmd, &msg);
@@ -20,7 +20,7 @@ WpTestFuncResult test_commander_cmd_success(void) {
WpTestFuncResult test_commander_cmd_failure(void) {
WpStr8List cmd = wapp_dbl_list(WpStr8);
WpStr8 grep = wapp_str8_lit("grep");
WpStr8 grep = wpStr8Lit("grep");
wapp_dbl_list_push_back(WpStr8, &cmd, &grep);
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_DISCARD, nullptr, &cmd);
@@ -31,39 +31,39 @@ WpTestFuncResult test_commander_cmd_failure(void) {
}
WpTestFuncResult test_commander_cmd_out_buf_success(void) {
WpStr8 buf = wapp_str8_buf(64);
WpStr8 expected = wapp_str8_buf(64);
WpStr8 buf = wpStr8Buf(64);
WpStr8 expected = wpStr8Buf(64);
char msg[] = "hello world";
wapp_str8_copy_cstr_capped(&expected, msg);
wpStr8CopyCstrCapped(&expected, msg);
WpStr8List cmd = wapp_dbl_list(WpStr8);
WpStr8 echo = wapp_str8_lit("echo");
WpStr8 arg = wapp_str8_lit(msg);
WpStr8 echo = wpStr8Lit("echo");
WpStr8 arg = wpStr8Lit(msg);
wapp_dbl_list_push_back(WpStr8, &cmd, &echo);
wapp_dbl_list_push_back(WpStr8, &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));
result.error == SHELL_ERR_NO_ERROR && wpStr8EqualToCount(&buf, &expected, strlen(msg));
return wpTesterResult(succeeded);
}
WpTestFuncResult test_commander_cmd_out_buf_failure(void) {
WpStr8 buf = wapp_str8_buf(4);
WpStr8 expected = wapp_str8_buf(64);
WpStr8 buf = wpStr8Buf(4);
WpStr8 expected = wpStr8Buf(64);
char msg[] = "hello world";
wapp_str8_copy_cstr_capped(&expected, msg);
wpStr8CopyCstrCapped(&expected, msg);
WpStr8List cmd = wapp_dbl_list(WpStr8);
WpStr8 echo = wapp_str8_lit("echo");
WpStr8 arg = wapp_str8_lit(msg);
WpStr8 echo = wpStr8Lit("echo");
WpStr8 arg = wpStr8Lit(msg);
wapp_dbl_list_push_back(WpStr8, &cmd, &echo);
wapp_dbl_list_push_back(WpStr8, &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);
result.error == SHELL_ERR_OUT_BUF_FULL && !wpStr8Equal(&buf, &expected);
return wpTesterResult(failed);
}