mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
quote marking: ensure that double quotes also work
This commit is contained in:
parent
c1f337af01
commit
616cb0bc09
1 changed files with 6 additions and 3 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/02/13 15:17:56 by khais #+# #+# */
|
/* Created: 2025/02/13 15:17:56 by khais #+# #+# */
|
||||||
/* Updated: 2025/03/06 15:17:10 by khais ### ########.fr */
|
/* Updated: 2025/03/06 15:46:23 by khais ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -79,15 +79,18 @@ static void test_wordsplit_multiword_with_single_quotes(void)
|
||||||
wordlist_destroy(words);
|
wordlist_destroy(words);
|
||||||
}
|
}
|
||||||
|
|
||||||
// kco work marker
|
|
||||||
|
|
||||||
static void test_wordsplit_multiword_with_double_quotes(void)
|
static void test_wordsplit_multiword_with_double_quotes(void)
|
||||||
{
|
{
|
||||||
t_wordlist *words;
|
t_wordlist *words;
|
||||||
|
|
||||||
words = minishell_wordsplit("\t echo\t\" \t The file is named $MYFILE \" \t");
|
words = minishell_wordsplit("\t echo\t\" \t The file is named $MYFILE \" \t");
|
||||||
assert_strequal("echo", wordlist_get(words, 0)->word);
|
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);
|
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));
|
assert(NULL == wordlist_get(words, 2));
|
||||||
wordlist_destroy(words);
|
wordlist_destroy(words);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue