Update dbl list API

This commit is contained in:
2026-01-11 18:20:57 +00:00
parent b88cb71aa8
commit 2148182093
13 changed files with 455 additions and 533 deletions

View File

@@ -5,9 +5,9 @@
#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);
wapp_dbl_list_push_back(Str8, &cmd, &wapp_str8_lit("echo"));
wapp_dbl_list_push_back(Str8, &cmd, &wapp_str8_lit("hello world"));
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_DISCARD, NULL, &cmd);
b8 succeeded = result.exited && result.exit_code == EXIT_SUCCESS &&
@@ -17,8 +17,8 @@ TestFuncResult test_commander_cmd_success(void) {
}
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);
wapp_dbl_list_push_back(Str8, &cmd, &wapp_str8_lit("grep"));
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_DISCARD, NULL, &cmd);
b8 failed = result.exited && result.exit_code != EXIT_SUCCESS &&
@@ -33,9 +33,9 @@ TestFuncResult test_commander_cmd_out_buf_success(void) {
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);
wapp_dbl_list_push_back(Str8, &cmd, &wapp_str8_lit("echo"));
wapp_dbl_list_push_back(Str8, &cmd, &wapp_str8_lit(msg));
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_CAPTURE, &buf, &cmd);
b8 succeeded = result.exited && result.exit_code == EXIT_SUCCESS &&
@@ -50,9 +50,9 @@ TestFuncResult test_commander_cmd_out_buf_failure(void) {
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);
wapp_dbl_list_push_back(Str8, &cmd, &wapp_str8_lit("echo"));
wapp_dbl_list_push_back(Str8, &cmd, &wapp_str8_lit(msg));
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_CAPTURE, &buf, &cmd);
b8 failed = !result.exited && result.exit_code != EXIT_SUCCESS &&