summaryrefslogtreecommitdiff
path: root/tests-clar
diff options
context:
space:
mode:
authorCarlos Martín Nieto <carlos@cmartin.tk>2012-03-16 12:52:49 +0100
committerCarlos Martín Nieto <carlos@cmartin.tk>2012-04-16 10:25:52 +0200
commit2c1075d65a344f8fa166b4c1eb8320f389653187 (patch)
tree35bc0d20152a27dfbe1a365908cfb77664ad8f40 /tests-clar
parent3fa1ec4af63f30c8e205f18439f6eb5cc7e6898c (diff)
downloadlibgit2-2c1075d65a344f8fa166b4c1eb8320f389653187.tar.gz
config: parse quoted values
Variable values may be quoted to include newlines, literal quotes and other characters. Add support for these and test it.
Diffstat (limited to 'tests-clar')
-rw-r--r--tests-clar/config/stress.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests-clar/config/stress.c b/tests-clar/config/stress.c
index 25c2c66db..54a61ad67 100644
--- a/tests-clar/config/stress.c
+++ b/tests-clar/config/stress.c
@@ -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);
+}