mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
cmdgroup parsing: ensure parsing of a pipeline functions correctly
This commit is contained in:
parent
0f0d3ea0bd
commit
d6bb24df54
1 changed files with 20 additions and 2 deletions
|
|
@ -5,8 +5,8 @@
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/03/11 17:30/41 by khais #+# #+# */
|
/* Created: 2025/03/18 11:43/36 by khais #+# #+# */
|
||||||
/* Updated: 2025/03/11 17:30:41 by khais ### ########.fr */
|
/* Updated: 2025/03/18 11:43:36 by khais ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -47,10 +47,28 @@ static void test_cmdgroup_parsing_single_cmdlist(void)
|
||||||
do_leak_check();
|
do_leak_check();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_cmdgroup_parsing_two_cmdlist(void)
|
||||||
|
{
|
||||||
|
t_cmdgroup *cmd;
|
||||||
|
|
||||||
|
// arange
|
||||||
|
ft_dprintf(STDERR_FILENO, "==> %s <==\n", __FUNCTION__);
|
||||||
|
cmd = parse_cmdgroup("echo this | cat -e && echo works | wc -c");
|
||||||
|
// assert
|
||||||
|
assert(NULL != cmd);
|
||||||
|
assert(1 == cmd->item_num);
|
||||||
|
assert(TYPE_LIST == cmd->items[0].type);
|
||||||
|
assert_cmdgroup_itemlistequal("echo this | cat -e && echo works | wc -c", cmd, 0);
|
||||||
|
// cleanup
|
||||||
|
cmdgroup_destroy(cmd);
|
||||||
|
do_leak_check();
|
||||||
|
}
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
test_cmdgroup_parsing_empty();
|
test_cmdgroup_parsing_empty();
|
||||||
test_cmdgroup_parsing_single_cmdlist();
|
test_cmdgroup_parsing_single_cmdlist();
|
||||||
|
test_cmdgroup_parsing_two_cmdlist();
|
||||||
// redirections
|
// redirections
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue