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:
authorSven Strickroth <email@cs-ware.de>2013-11-07 16:38:04 +0400
committerSven Strickroth <email@cs-ware.de>2013-11-07 16:45:28 +0400
commita9f7236affefc9918a8d3f2511fc4e5345d69942 (patch)
tree6ba3f6cb6404ba33e70443b79d00294a53b627dc /tests-clar
parentfde93250320f97cd6cf93be1e4ab09fd330e001f (diff)
Add a testcase for values which needs quotes
Signed-off-by: Sven Strickroth <email@cs-ware.de>
Diffstat (limited to 'tests-clar')
-rw-r--r--tests-clar/config/write.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests-clar/config/write.c b/tests-clar/config/write.c
index 57b02a7d9..c93c08a1a 100644
--- a/tests-clar/config/write.c
+++ b/tests-clar/config/write.c
@@ -229,6 +229,33 @@ void test_config_write__add_value_at_file_with_no_clrf_at_the_end(void)
git_config_free(cfg);
}
+void test_config_write__add_value_which_needs_quotes(void)
+{
+ git_config *cfg;
+ const char* str1;
+ const char* str2;
+ const char* str3;
+ const char* str4;
+
+ cl_git_pass(git_config_open_ondisk(&cfg, "config17"));
+ cl_git_pass(git_config_set_string(cfg, "core.startwithspace", " Something"));
+ cl_git_pass(git_config_set_string(cfg, "core.endwithspace", "Something "));
+ cl_git_pass(git_config_set_string(cfg, "core.containscommentchar1", "some#thing"));
+ cl_git_pass(git_config_set_string(cfg, "core.containscommentchar2", "some;thing"));
+ git_config_free(cfg);
+
+ cl_git_pass(git_config_open_ondisk(&cfg, "config17"));
+ cl_git_pass(git_config_get_string(&str1, cfg, "core.startwithspace"));
+ cl_assert_equal_s(" Something", str1);
+ cl_git_pass(git_config_get_string(&str2, cfg, "core.endwithspace"));
+ cl_assert_equal_s("Something ", str2);
+ cl_git_pass(git_config_get_string(&str3, cfg, "core.containscommentchar1"));
+ cl_assert_equal_s("some#thing", str3);
+ cl_git_pass(git_config_get_string(&str4, cfg, "core.containscommentchar2"));
+ cl_assert_equal_s("some;thing", str4);
+ git_config_free(cfg);
+}
+
void test_config_write__can_set_a_value_to_NULL(void)
{
git_repository *repository;