#include "settings-parser.h"
#include "config-filter.h"
#include "test-common.h"
+#include "test-dir.h"
#include "all-settings.h"
#include "config-parser.h"
-#define TEST_CONFIG_FILE ".test-config"
+#define TEST_CONFIG_FILE "config"
static const struct config_service test_config_all_services[] = { { NULL, NULL } };
const struct config_service *config_all_services = test_config_all_services;
static void write_config_file(const char *contents)
{
- struct ostream *os = o_stream_create_file(TEST_CONFIG_FILE, 0, 0600, 0);
+ const char *config_file = test_dir_prepend(TEST_CONFIG_FILE);
+ struct ostream *os = o_stream_create_file(config_file, 0, 0600, 0);
o_stream_nsend_str(os, contents);
test_assert(o_stream_finish(os) == 1);
o_stream_unref(&os);
{
struct config_parsed *config;
const char *error = NULL;
+ const char *config_file = test_dir_prepend(TEST_CONFIG_FILE);
test_begin("config_parse_file");
putenv("bar=test2");
putenv("FOO$ENV:FOO=works");
- test_assert(config_parse_file(TEST_CONFIG_FILE,
+ test_assert(config_parse_file(config_file,
CONFIG_PARSE_FLAG_EXPAND_VALUES |
CONFIG_PARSE_FLAG_NO_DEFAULTS,
NULL, &config, &error) == 1);
config_parsed_free(&config);
/* try again unexpanded */
- test_assert(config_parse_file(TEST_CONFIG_FILE,
+ test_assert(config_parse_file(config_file,
CONFIG_PARSE_FLAG_NO_DEFAULTS,
NULL, &config, &error) == 1);
settings_parser_unref(&set_parser);
config_parsed_free(&config);
config_parser_deinit();
- i_unlink_if_exists(TEST_CONFIG_FILE);
+ i_unlink_if_exists(config_file);
pool_unref(&pool);
test_end();
}
test_config_parser,
NULL
};
+
+ test_dir_init("config-parser");
return test_run(test_functions);
}