mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
cmdgroup parsing: start implementing the new architecture
This commit is contained in:
parent
d6bb24df54
commit
f9aa614ef2
4 changed files with 18 additions and 30 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/13 15:21:09 by khais #+# #+# */
|
||||
/* Updated: 2025/03/11 18:12:05 by khais ### ########.fr */
|
||||
/* Updated: 2025/03/18 11:50:23 by khais ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -128,24 +128,17 @@ t_cmdgroup *parse_cmdgroup(char *input)
|
|||
void assert_cmdgroup_itemlistequal(char *expected_str, t_cmdgroup *got_cmd, int item_number)
|
||||
{
|
||||
ft_dprintf(STDERR_FILENO, "checking that item %d of cmdlist %p matches [%s]\n", item_number, got_cmd, expected_str);
|
||||
ft_dprintf(STDERR_FILENO, "expecteing to have at least %d items, and got %d\n", item_number + 1, got_cmd->item_num);
|
||||
assert(got_cmd->item_num > item_number);
|
||||
ft_dprintf(STDERR_FILENO, "expecteing item %p to be of type list got %d\n", got_cmd->items[item_number], got_cmd->items[item_number].type);
|
||||
t_cmdlist *expected = parse_command_list(expected_str);
|
||||
t_cmdlist *got = got_cmd->items[item_number].inner.cmdlist;
|
||||
if (expected == NULL)
|
||||
{
|
||||
ft_dprintf(STDERR_FILENO, "expecting the list to be null\n");
|
||||
assert(expected == got);
|
||||
return ;
|
||||
}
|
||||
ft_dprintf(STDERR_FILENO, "checking if the list matches...\n");
|
||||
assert(expected->num_pipelines == got->num_pipelines);
|
||||
int i = 0;
|
||||
while (i < expected->num_pipelines)
|
||||
{
|
||||
assert_pipelineequal_raw(expected->pipelines[i], got->pipelines[i]);
|
||||
assert(expected->operators[i] == got->operators[i]);
|
||||
i++;
|
||||
}
|
||||
assert(false && "not yet implemented");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue