mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
37 lines
1.4 KiB
C
37 lines
1.4 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* parse_simple_cmds.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2025/02/21 12:20:20 by khais #+# #+# */
|
|
/* Updated: 2025/02/21 12:33:32 by khais ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include <assert.h>
|
|
#include "../src/parser/simple_cmd/simple_cmd.h"
|
|
#include "../src/parser/wordsplit/wordsplit.h"
|
|
#include "../src/parser/wordlist/wordlist.h"
|
|
|
|
static t_simple_cmd *parse_simple_cmd(char *input)
|
|
{
|
|
t_wordlist *words = minishell_wordsplit(input);
|
|
t_simple_cmd *cmd = simple_cmd_from_wordlist(words);
|
|
wordlist_destroy(words);
|
|
return (cmd);
|
|
}
|
|
|
|
static void test_parse_empty_command(void)
|
|
{
|
|
t_simple_cmd *cmd = parse_simple_cmd("");
|
|
assert(cmd != NULL);
|
|
simple_cmd_destroy(cmd);
|
|
}
|
|
|
|
int main(void)
|
|
{
|
|
test_parse_empty_command();
|
|
return (0);
|
|
}
|