Files
ash/tests/tsource.c
Anonymus Raccoon 2a15ae6e14 Solving tests
2020-05-23 19:17:31 +02:00

36 lines
830 B
C

/*
** EPITECH PROJECT, 2020
** ash
** File description:
** test source function
*/
#include <criterion/criterion.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include "shell.h"
#include "utility.h"
#include "builtin.h"
Test(get_special_arg_at, at_arg)
{
char **argv = split_str(strdup("source file a b c"), (char *[]) {" ", NULL});
int argv_len = 5;
char *res = NULL;
for (; argv[argv_len]; argv_len++);
res = get_special_arg_at(argv, argv_len);
cr_assert_str_eq(res, "\"a\" \"b\" \"c\"");
}
Test(get_special_arg_star, at_arg)
{
char **argv = split_str(strdup("source file a b c"), (char *[]) {" ", NULL});
int argv_len = 5;
char *res = NULL;
for (; argv[argv_len]; argv_len++);
res = get_special_arg_star(argv, argv_len);
cr_assert_str_eq(res, "\"a b c\"");
}