Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'tests-clar/config/stress.c')
-rw-r--r--tests-clar/config/stress.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/tests-clar/config/stress.c b/tests-clar/config/stress.c
index e3b1114f0..3de1f7692 100644
--- a/tests-clar/config/stress.c
+++ b/tests-clar/config/stress.c
@@ -27,13 +27,35 @@ void test_config_stress__dont_break_on_invalid_input(void)
struct git_config_file *file;
git_config *config;
- cl_git_pass(git_path_exists("git-test-config"));
+ cl_assert(git_path_exists("git-test-config"));
cl_git_pass(git_config_file__ondisk(&file, "git-test-config"));
cl_git_pass(git_config_new(&config));
cl_git_pass(git_config_add_file(config, file, 0));
- cl_git_pass(git_config_get_string(config, "color.ui", &color));
- cl_git_pass(git_config_get_string(config, "core.editor", &editor));
+ cl_git_pass(git_config_get_string(&color, config, "color.ui"));
+ cl_git_pass(git_config_get_string(&editor, config, "core.editor"));
+
+ git_config_free(config);
+}
+
+void test_config_stress__comments(void)
+{
+ struct git_config_file *file;
+ git_config *config;
+ const char *str;
+
+ cl_git_pass(git_config_file__ondisk(&file, cl_fixture("config/config12")));
+ cl_git_pass(git_config_new(&config));
+ cl_git_pass(git_config_add_file(config, file, 0));
+
+ cl_git_pass(git_config_get_string(&str, config, "some.section.other"));
+ cl_assert(!strcmp(str, "hello! \" ; ; ; "));
+
+ cl_git_pass(git_config_get_string(&str, config, "some.section.multi"));
+ cl_assert(!strcmp(str, "hi, this is a ; multiline comment # with ;\n special chars and other stuff !@#"));
+
+ cl_git_pass(git_config_get_string(&str, config, "some.section.back"));
+ cl_assert(!strcmp(str, "this is \ba phrase"));
git_config_free(config);
}