pipeline parse: detect and reject pipe at start of command

This commit is contained in:
Khaïs COLIN 2025-02-24 15:22:00 +01:00
parent 36df14e599
commit a8711568c1
Signed by: logistic-bot
SSH key fingerprint: SHA256:RlpiqKeXpcPFZZ4y9Ou4xi2M8OhRJovIwDlbCaMsuAo
2 changed files with 14 additions and 2 deletions

View file

@ -6,7 +6,7 @@
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/21 13:13:58 by khais #+# #+# */
/* Updated: 2025/02/21 16:03:39 by khais ### ########.fr */
/* Updated: 2025/02/24 15:19:39 by khais ### ########.fr */
/* */
/* ************************************************************************** */
@ -110,6 +110,13 @@ static void test_parse_pipeline_triple_pipe_rejected(void)
assert(ft_errno_get() == FT_EUNEXPECTED_PIPE);
}
static void test_parse_pipeline_pipe_at_start_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();
@ -119,5 +126,6 @@ int main(void)
test_parse_pipeline_four_cmd();
test_parse_pipeline_double_pipe_rejected();
test_parse_pipeline_triple_pipe_rejected();
test_parse_pipeline_pipe_at_start_rejected();
return (0);
}