mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
pipeline: reject repetitions of '|' token
This commit is contained in:
parent
68e923c09e
commit
c9f8c5a4f9
4 changed files with 27 additions and 6 deletions
|
|
@ -6,12 +6,13 @@
|
|||
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/21 13:13:58 by khais #+# #+# */
|
||||
/* Updated: 2025/02/21 15:29:48 by khais ### ########.fr */
|
||||
/* Updated: 2025/02/21 16:03:39 by khais ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../src/parser/pipeline/pipeline.h"
|
||||
#include "../src/parser/wordsplit/wordsplit.h"
|
||||
#include "../src/ft_errno.h"
|
||||
#include <assert.h>
|
||||
#include "ft_printf.h"
|
||||
#include "libft.h"
|
||||
|
|
@ -95,6 +96,20 @@ static void test_parse_pipeline_four_cmd(void)
|
|||
pipeline_destroy(pipeline);
|
||||
}
|
||||
|
||||
static void test_parse_pipeline_double_pipe_rejected(void)
|
||||
{
|
||||
ft_errno(FT_ESUCCESS);
|
||||
assert(parse_pipeline("echo hello | | tee output.txt") == NULL);
|
||||
assert(ft_errno_get() == FT_EUNEXPECTED_PIPE);
|
||||
}
|
||||
|
||||
static void test_parse_pipeline_triple_pipe_rejected(void)
|
||||
{
|
||||
ft_errno(FT_ESUCCESS);
|
||||
assert(parse_pipeline("echo hello | | | tee output.txt") == NULL);
|
||||
assert(ft_errno_get() == FT_EUNEXPECTED_PIPE);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
test_parse_empty_pipeline();
|
||||
|
|
@ -102,5 +117,7 @@ int main(void)
|
|||
test_parse_pipeline_two_cmd();
|
||||
test_parse_pipeline_three_cmd();
|
||||
test_parse_pipeline_four_cmd();
|
||||
test_parse_pipeline_double_pipe_rejected();
|
||||
test_parse_pipeline_triple_pipe_rejected();
|
||||
return (0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue