mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
wordsplit: handle single word with spaces before or after
This commit is contained in:
parent
fc985ea046
commit
8defbf4d13
9 changed files with 154 additions and 16 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/13 15:17:56 by khais #+# #+# */
|
||||
/* Updated: 2025/02/13 17:24:33 by khais ### ########.fr */
|
||||
/* Updated: 2025/02/14 13:35:26 by khais ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -28,6 +28,16 @@ void test_wordsplit_singleword(void)
|
|||
wordlist_destroy(words);
|
||||
}
|
||||
|
||||
void test_wordsplit_singleword_with_spaces(void)
|
||||
{
|
||||
t_wordlist *words;
|
||||
|
||||
words = minishell_wordsplit(" echo ");
|
||||
assert_strequal("echo", wordlist_get(words, 0)->word);
|
||||
assert(NULL == wordlist_get(words, 1));
|
||||
wordlist_destroy(words);
|
||||
}
|
||||
|
||||
void test_wordsplit_basic(void)
|
||||
{
|
||||
t_wordlist *words;
|
||||
|
|
@ -45,5 +55,6 @@ void test_wordsplit_basic(void)
|
|||
|
||||
int main(void) {
|
||||
test_wordsplit_singleword();
|
||||
test_wordsplit_singleword_with_spaces();
|
||||
return (0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue