diff options
| author | Carlos Martín Nieto <carlos@cmartin.tk> | 2012-07-20 17:52:53 +0200 |
|---|---|---|
| committer | Carlos Martín Nieto <carlos@cmartin.tk> | 2012-07-21 02:28:46 +0200 |
| commit | 5d9cfa07ac62ad15ebb669b01e723a990450383e (patch) | |
| tree | 584b11f66e5d9a7324b4ad5d9d81730d1a3ac626 /tests-clar/config/stress.c | |
| parent | c8a1892e7187d8b9be81c9fbd5b2fbb172be1ee2 (diff) | |
| download | libgit2-5d9cfa07ac62ad15ebb669b01e723a990450383e.tar.gz | |
config: escape subsection names when creating them
This allows us to set options like "some.foo\\ish.var".
This closes #830
Diffstat (limited to 'tests-clar/config/stress.c')
| -rw-r--r-- | tests-clar/config/stress.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests-clar/config/stress.c b/tests-clar/config/stress.c index 3de1f769..8fbc8b97 100644 --- a/tests-clar/config/stress.c +++ b/tests-clar/config/stress.c @@ -59,3 +59,25 @@ void test_config_stress__comments(void) git_config_free(config); } + +void test_config_stress__escape_subsection_names(void) +{ + struct git_config_file *file; + git_config *config; + const char *str; + + 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_set_string(config, "some.sec\\tion.other", "foo")); + git_config_free(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(&str, config, "some.sec\\tion.other")); + cl_assert(!strcmp("foo", str)); +} |
