command list parsing: handle empty input

This is really not that usefull, it is more to setup the groundwork
This commit is contained in:
Khaïs COLIN 2025-02-24 17:52:05 +01:00 committed by Khaïs COLIN
parent 1c653d9665
commit eb21f00156
5 changed files with 129 additions and 0 deletions

View file

@ -3,6 +3,7 @@
rawtests = \
quote_removal \
metacharacters \
parse_command_lists \
parse_pipelines \
parse_simple_cmds \
test_env_manip \

View file

@ -0,0 +1,36 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* parse_command_lists.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/24 17:40:48 by khais #+# #+# */
/* Updated: 2025/02/24 17:47:39 by khais ### ########.fr */
/* */
/* ************************************************************************** */
#include "../src/parser/command_list/command_list.h"
#include "../src/parser/wordsplit/wordsplit.h"
#include <assert.h>
static t_command_list *parse_command_list(char *input)
{
t_wordlist *words = minishell_wordsplit(input);
t_command_list *cmd = command_list_from_wordlist(words);
return (cmd);
}
static void test_parse_command_list_empty(void)
{
t_command_list *cmd = parse_command_list("");
assert(cmd == NULL);
command_list_destroy(cmd);
}
int main(void)
{
test_parse_command_list_empty();
return (0);
}