Alien-SVN
view release on metacpan or search on metacpan
src/subversion/subversion/tests/libsvn_subr/config-test.c view on Meta::CPAN
svn_config_t *cfg;
const char *cfg_file;
svn_stream_t *stream;
if (!srcdir)
SVN_ERR(init_params(pool));
cfg_file = apr_pstrcat(pool, srcdir, "/", "config-test.cfg", (char *)NULL);
SVN_ERR(svn_stream_open_readonly(&stream, cfg_file, pool, pool));
SVN_ERR(svn_config_parse(&cfg, stream, TRUE, TRUE, pool));
/* nominal test to make sure cfg is populated with something since
* svn_config_parse will happily return an empty cfg if the stream is
* empty. */
if (! svn_config_has_section(cfg, "section1"))
return fail(pool, "Failed to find section1");
return SVN_NO_ERROR;
}
static svn_error_t *
test_ignore_bom(apr_pool_t *pool)
{
svn_config_t *cfg;
svn_string_t *cfg_string = svn_string_create("\xEF\xBB\xBF[s1]\nfoo=bar\n",
pool);
svn_stream_t *stream = svn_stream_from_string(cfg_string, pool);
SVN_ERR(svn_config_parse(&cfg, stream, TRUE, TRUE, pool));
if (! svn_config_has_section(cfg, "s1"))
return fail(pool, "failed to find section s1");
return SVN_NO_ERROR;
}
/*
====================================================================
If you add a new test to this file, update this array.
(These globals are required by our included main())
*/
/* An array of all test functions */
struct svn_test_descriptor_t test_funcs[] =
{
SVN_TEST_NULL,
SVN_TEST_PASS2(test_text_retrieval,
"test svn_config"),
SVN_TEST_PASS2(test_boolean_retrieval,
"test svn_config boolean conversion"),
SVN_TEST_PASS2(test_has_section_case_insensitive,
"test svn_config_has_section (case insensitive)"),
SVN_TEST_PASS2(test_has_section_case_sensitive,
"test svn_config_has_section (case sensitive)"),
SVN_TEST_PASS2(test_has_option_case_sensitive,
"test case-sensitive option name lookup"),
SVN_TEST_PASS2(test_stream_interface,
"test svn_config_parse"),
SVN_TEST_PASS2(test_ignore_bom, "test parsing config file with BOM"),
SVN_TEST_NULL
};
( run in 1.536 second using v1.01-cache-2.11-cpan-ceb78f64989 )