mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
env_set_entry: use ft_errno to indicate error conditions
This commit is contained in:
parent
df8aec148f
commit
e985fcc562
5 changed files with 32 additions and 17 deletions
|
|
@ -6,11 +6,12 @@
|
|||
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/18 15:11:14 by khais #+# #+# */
|
||||
/* Updated: 2025/02/19 12:23:50 by khais ### ########.fr */
|
||||
/* Updated: 2025/02/19 13:15:43 by khais ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../src/env_manip.h"
|
||||
#include "../src/ft_errno.h"
|
||||
#include "libft.h"
|
||||
#include "testutil.h"
|
||||
#include "unistd.h"
|
||||
|
|
@ -79,9 +80,13 @@ static void test_env_set_entry_nullargs(void)
|
|||
|
||||
env = NULL;
|
||||
assert(env_set_entry(&env, ft_strdup("VAR"), ft_strdup("hello")) != NULL);
|
||||
ft_errno(FT_ESUCCESS);
|
||||
assert(env_set_entry(&env, NULL, ft_strdup("hello")) == NULL);
|
||||
assert(ft_errno_get() == FT_EINVAL);
|
||||
assert(env_set_entry(&env, ft_strdup("VAR"), NULL) == NULL);
|
||||
assert(env_set_entry(&env, ft_strdup(""), ft_strdup("value")) == env);
|
||||
ft_errno(FT_ESUCCESS);
|
||||
assert(env_set_entry(&env, ft_strdup(""), ft_strdup("value")) == NULL);
|
||||
assert(ft_errno_get() == FT_EBADID);
|
||||
assert_env_value(env, "VAR", "hello");
|
||||
assert(1 == env_get_size(env));
|
||||
env_destroy(env);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue