mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
31 lines
1.4 KiB
C
31 lines
1.4 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* env_manip.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2025/02/18 15:11:14 by khais #+# #+# */
|
|
/* Updated: 2025/02/18 15:25:35 by khais ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "../src/env_manip.h"
|
|
#include "libft.h"
|
|
#include <assert.h>
|
|
|
|
static void test_envp_get_key(char *line, char *expected_key)
|
|
{
|
|
char *value = envp_get_key(line);
|
|
ft_dprintf(STDERR_FILENO, "for envp value '%s', expecting key to eq '%s', and got '%s'\n", line, expected_key, value);
|
|
assert(expected_key == value || ft_strcmp(expected_key, value) == 0);
|
|
free(value);
|
|
}
|
|
|
|
int main(void) {
|
|
test_envp_get_key("SHELL=/bin/fish", "SHELL");
|
|
test_envp_get_key("=/bin/fish", "");
|
|
test_envp_get_key(NULL, NULL);
|
|
test_envp_get_key("", NULL);
|
|
return (0);
|
|
}
|