mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
cmdlist: use new architecture (STUB)
I fixed the tests, and the basic functionallity of detecting pipelines works, but detecting nested cmdgroups is not yet implemented
This commit is contained in:
parent
8f7e7f7dfe
commit
56fe943efc
13 changed files with 116 additions and 69 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/13 15:21:09 by khais #+# #+# */
|
||||
/* Updated: 2025/03/18 11:50:23 by khais ### ########.fr */
|
||||
/* Updated: 2025/03/18 13:09:16 by khais ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
#include "parse_pipeline.h"
|
||||
#include "../src/parser/wordlist/wordlist.h"
|
||||
#include "../src/parser/wordsplit/wordsplit.h"
|
||||
#include "../src/parser/cmdgroup/cmdgroup_item.h"
|
||||
#include "../src/parser/command_list/command_list_item.h"
|
||||
|
||||
void assert_strequal(char *str1, char *str2)
|
||||
{
|
||||
|
|
@ -84,9 +84,9 @@ void assert_pipelineequal_raw(t_pipeline *expected, t_pipeline *got)
|
|||
|
||||
void assert_pipelineequal(char *expected, t_cmdlist *cmd, int idx)
|
||||
{
|
||||
ft_printf("Expected command list %p to have at least %d pipelines, and got %d\n", cmd, idx + 1, cmd->num_pipelines);
|
||||
assert(cmd->num_pipelines >= idx + 1);
|
||||
t_pipeline *got = cmd->pipelines[idx];
|
||||
ft_printf("Expected command list %p to have at least %d pipelines, and got %d\n", cmd, idx + 1, cmd->num_cmds);
|
||||
assert(cmd->num_cmds >= idx + 1);
|
||||
t_pipeline *got = cmd->cmds[idx]->inner.pipeline;
|
||||
ft_dprintf(STDERR_FILENO, "Expected pipeline %p to equal [%s]\n", got, expected);
|
||||
t_pipeline *expected_pipeline = parse_pipeline(expected);
|
||||
assert_pipelineequal_raw(expected_pipeline, got);
|
||||
|
|
@ -136,7 +136,7 @@ void assert_cmdgroup_itemlistequal(char *expected_str, t_cmdgroup *got_cmd, int
|
|||
}
|
||||
ft_dprintf(STDERR_FILENO, "checking if the list matches...\n");
|
||||
int i = 0;
|
||||
while (i < expected->num_pipelines)
|
||||
while (i < expected->num_cmds)
|
||||
{
|
||||
i++;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue