quote marking: single-quotes are marked

This commit is contained in:
Khaïs COLIN 2025-03-06 15:06:31 +01:00
parent e99c7e5986
commit c1f337af01
Signed by: logistic-bot
SSH key fingerprint: SHA256:RlpiqKeXpcPFZZ4y9Ou4xi2M8OhRJovIwDlbCaMsuAo
3 changed files with 23 additions and 6 deletions

View file

@ -6,13 +6,15 @@
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/13 15:17:56 by khais #+# #+# */
/* Updated: 2025/03/06 15:05:58 by khais ### ########.fr */
/* Updated: 2025/03/06 15:17:10 by khais ### ########.fr */
/* */
/* ************************************************************************** */
#include <assert.h>
#include "testutil.h"
#include "../src/parser/wordsplit/wordsplit.h"
#include <unistd.h>
#include "libft.h"
#include <stdlib.h>
/*
@ -61,19 +63,24 @@ static void test_wordsplit_multiword(void)
wordlist_destroy(words);
}
// kco work marker
static void test_wordsplit_multiword_with_single_quotes(void)
{
t_wordlist *words;
words = minishell_wordsplit("\t echo\t' \t The file is named $MYFILE ' \t");
assert_strequal("echo", wordlist_get(words, 0)->word);
assert_strequal(" ", wordlist_get(words, 0)->marker);
assert_strequal("' \t The file is named $MYFILE '", wordlist_get(words, 1)->word);
// This marker is one char shorter because the tab character above is
// represented here with two chars
ft_dprintf(STDERR_FILENO, "the marker below is shorter than the string above because the string above contains a tab, it is normal\n");
assert_strequal(" '''''''''''''''''''''''''''''''''' ", wordlist_get(words, 1)->marker);
assert(NULL == wordlist_get(words, 2));
wordlist_destroy(words);
}
// kco work marker
static void test_wordsplit_multiword_with_double_quotes(void)
{
t_wordlist *words;