summaryrefslogtreecommitdiff
path: root/tests-clar/config/stress.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests-clar/config/stress.c')
-rw-r--r--tests-clar/config/stress.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/tests-clar/config/stress.c b/tests-clar/config/stress.c
index e3b1114f0..54a61ad67 100644
--- a/tests-clar/config/stress.c
+++ b/tests-clar/config/stress.c
@@ -27,7 +27,7 @@ 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));
@@ -37,3 +37,25 @@ void test_config_stress__dont_break_on_invalid_input(void)
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(config, "some.section.other", &str));
+ cl_assert(!strcmp(str, "hello! \" ; ; ; "));
+
+ cl_git_pass(git_config_get_string(config, "some.section.multi", &str));
+ cl_assert(!strcmp(str, "hi, this is a ; multiline comment # with ;\n special chars and other stuff !@#"));
+
+ cl_git_pass(git_config_get_string(config, "some.section.back", &str));
+ cl_assert(!strcmp(str, "this is \ba phrase"));
+
+ git_config_free(config);
+}