From 750be86aedb867a43680f872e1c9824379644739 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Sat, 9 Jun 2012 12:45:21 -0400 Subject: [PATCH] Add a test that shows we don't preserve quotes in config values --- tests-clar/config/write.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests-clar/config/write.c b/tests-clar/config/write.c index f8774473e..04811d7f0 100644 --- a/tests-clar/config/write.c +++ b/tests-clar/config/write.c @@ -90,3 +90,20 @@ void test_config_write__delete_inexistent(void) cl_assert(git_config_delete(cfg, "core.imaginary") == GIT_ENOTFOUND); git_config_free(cfg); } + +void test_config_write__value_containing_quotes(void) +{ + git_config *cfg; + const char* str; + + cl_git_pass(git_config_open_ondisk(&cfg, "config9")); + cl_git_pass(git_config_set_string(cfg, "core.somevar", "this \"has\" quotes")); + cl_git_pass(git_config_get_string(&str, cfg, "core.somevar")); + cl_assert_equal_s(str, "this \"has\" quotes"); + git_config_free(cfg); + + cl_git_pass(git_config_open_ondisk(&cfg, "config9")); + cl_git_pass(git_config_get_string(&str, cfg, "core.somevar")); + cl_assert_equal_s(str, "this \"has\" quotes"); + git_config_free(cfg); +}