2025-03-07 11:52:28 +01:00
|
|
|
/* ************************************************************************** */
|
|
|
|
|
/* */
|
|
|
|
|
/* ::: :::::::: */
|
|
|
|
|
/* test_here_doc.c :+: :+: :+: */
|
|
|
|
|
/* +:+ +:+ +:+ */
|
|
|
|
|
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
|
|
|
|
/* +#+#+#+#+#+ +#+ */
|
|
|
|
|
/* Created: 2025/03/07 11:43:32 by khais #+# #+# */
|
2025-03-10 18:22:22 +01:00
|
|
|
/* Updated: 2025/03/10 18:23:36 by khais ### ########.fr */
|
2025-03-07 11:52:28 +01:00
|
|
|
/* */
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
|
#include "testutil.h"
|
|
|
|
|
#include "libft.h"
|
|
|
|
|
#include <unistd.h>
|
2025-03-10 18:22:22 +01:00
|
|
|
#include "../src/executing/here_doc/here_doc.h"
|
|
|
|
|
|
|
|
|
|
static void test_here_doc_filename_generation(void)
|
|
|
|
|
{
|
|
|
|
|
char *filename1;
|
|
|
|
|
char *filename2;
|
|
|
|
|
|
|
|
|
|
ft_dprintf(STDERR_FILENO, "==> %s <==\n", __FUNCTION__);
|
|
|
|
|
filename1 = here_doc_random_filename();
|
|
|
|
|
filename2 = here_doc_random_filename();
|
|
|
|
|
assert(filename1 != NULL);
|
|
|
|
|
assert(filename2 != NULL);
|
|
|
|
|
ft_dprintf(STDERR_FILENO, "Got filename: [%s]\n", filename1);
|
|
|
|
|
ft_dprintf(STDERR_FILENO, "Got filename: [%s]\n", filename2);
|
|
|
|
|
assert(ft_strcmp(filename1, filename2) != 0);
|
|
|
|
|
free(filename1);
|
|
|
|
|
free(filename2);
|
|
|
|
|
do_leak_check();
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-07 11:52:28 +01:00
|
|
|
int main(void) {
|
2025-03-10 18:22:22 +01:00
|
|
|
test_here_doc_filename_generation();
|
2025-03-07 11:52:28 +01:00
|
|
|
return (0);
|
|
|
|
|
}
|