X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=tests%2Fparser.cc;h=5a8187552638b1d35b2c25311d2372ed3abb0e02;hb=16c2fe9cc04a3f15fe56d3be2f3be19a1d731fb2;hp=9eb8171494b4037d58c8ad6cc2e692dff1e47507;hpb=1f5cf20c75c7187df1d648a5a200b52db3f17db1;p=m6w6%2Flibmemcached diff --git a/tests/parser.cc b/tests/parser.cc index 9eb81714..5a818755 100644 --- a/tests/parser.cc +++ b/tests/parser.cc @@ -332,3 +332,49 @@ test_return_t parser_key_prefix_test(memcached_st *junk) (void)junk; return _test_option(distribution_strings); } + +test_return_t memcached_parse_file_options_test(memcached_st *junk) +{ + (void)junk; + memcached_st memc; + memcached_st *memc_ptr= memcached_create(&memc); + + test_true(memc_ptr); + + memcached_return_t rc= memcached_parse_file_options(memc_ptr, "support/example.cnf"); + test_true_got(rc == MEMCACHED_SUCCESS, rc == MEMCACHED_INVALID_ARGUMENTS ? memcached_last_error_message(&memc) : memcached_strerror(NULL, rc)); + memcached_free(memc_ptr); + + return TEST_SUCCESS; +} + +test_return_t memcached_check_options_test(memcached_st *junk) +{ + (void)junk; + + memcached_return_t rc; + + rc= memcached_check_options(STRING_WITH_LEN("--server=localhost"), NULL, 0); + test_true(rc == MEMCACHED_SUCCESS); + + rc= memcached_check_options(STRING_WITH_LEN("--dude=localhost"), NULL, 0); + test_false(rc == MEMCACHED_SUCCESS); + test_true(rc == MEMCACHED_PARSE_ERROR); + + return TEST_SUCCESS; +} + +test_return_t memcached_create_with_options_test(memcached_st *junk) +{ + (void)junk; + + memcached_st *memc_ptr; + memc_ptr= memcached_create_with_options(STRING_WITH_LEN("--server=localhost")); + test_true(memc_ptr); + memcached_free(memc_ptr); + + memc_ptr= memcached_create_with_options(STRING_WITH_LEN("--dude=localhost")); + test_false(memc_ptr); + + return TEST_SUCCESS; +}