static test_return_t putenv_localhost_quoted_TEST(void*)
{
- char set_env[1024];
-
- snprintf(set_env, sizeof(set_env), "LIBMEMCACHED=\"--server=localhost\"");
- test_zero(putenv(set_env));
+ test_zero(setenv("LIBMEMCACHED", "\"--server=localhost\"", 1));
test_null(memcached(NULL, 0));
return TEST_SUCCESS;
static test_return_t putenv_NULL_TEST(void*)
{
- char set_env[1024];
-
- snprintf(set_env, sizeof(set_env), "LIBMEMCACHED");
- test_zero(putenv(set_env));
- memcached_st *memc= memcached(NULL, 0);
- test_true(memc);
-
- memcached_free(memc);
-
- return TEST_SUCCESS;
-}
-
-static test_return_t putenv_NULL_TEST2(void*)
-{
- char set_env[1024];
-
- snprintf(set_env, sizeof(set_env), "LIBMEMCACHED=");
- test_zero(putenv(set_env));
+ test_zero(setenv("LIBMEMCACHED", "", 1));
memcached_st *memc= memcached(NULL, 0);
test_true(memc);
static test_return_t putenv_localhost_TEST(void*)
{
- char set_env[1024];
-
- snprintf(set_env, sizeof(set_env), "LIBMEMCACHED=--server=localhost");
- test_zero(putenv(set_env));
+ test_zero(setenv("LIBMEMCACHED", "--server=localhost", 1));
memcached_st *memc= memcached(NULL, 0);
test_true(memc);
{"memcached(\"value\", 0)", false, (test_callback_fn*)memcached_zero_string_length_TEST },
{"putenv(LIBMEMCACHED=--server=localhost)", false, (test_callback_fn*)putenv_localhost_TEST },
{"putenv(LIBMEMCACHED)", false, (test_callback_fn*)putenv_NULL_TEST },
- {"putenv(LIBMEMCACHED=)", false, (test_callback_fn*)putenv_NULL_TEST2 },
{"putenv(LIBMEMCACHED=--server=\"localhost\")", false, (test_callback_fn*)putenv_localhost_quoted_TEST },
{0, 0, 0}
};