summaryrefslogtreecommitdiff
path: root/tests-clar
diff options
context:
space:
mode:
authorVicent Martí <vicent@github.com>2013-10-01 05:54:54 -0700
committerVicent Martí <vicent@github.com>2013-10-01 05:54:54 -0700
commitc655aa5209e94200fd05bd618f48a757b2a6b2c8 (patch)
tree939c023f5e4959c8122ca3e9ff3e829905945817 /tests-clar
parentfba147631e5a05c5558a512c391e0b2eb47161e8 (diff)
parent8d741253849c5e377e50490818326adc56be9fce (diff)
downloadlibgit2-c655aa5209e94200fd05bd618f48a757b2a6b2c8.tar.gz
Merge pull request #1882 from linquize/config-subsection-fix
Config subsection name should allow to have ']' and '\\' should allow to escape any characters
Diffstat (limited to 'tests-clar')
-rw-r--r--tests-clar/config/read.c29
-rw-r--r--tests-clar/resources/config/config2011
2 files changed, 40 insertions, 0 deletions
diff --git a/tests-clar/config/read.c b/tests-clar/config/read.c
index 722a15a71..abc088d59 100644
--- a/tests-clar/config/read.c
+++ b/tests-clar/config/read.c
@@ -164,6 +164,13 @@ void test_config_read__empty_files(void)
git_config_free(cfg);
}
+void test_config_read__symbol_headers(void)
+{
+ git_config *cfg;
+ cl_git_pass(git_config_open_ondisk(&cfg, cl_fixture("config/config20")));
+ git_config_free(cfg);
+}
+
void test_config_read__header_in_last_line(void)
{
git_config *cfg;
@@ -524,6 +531,28 @@ void test_config_read__corrupt_header(void)
git_config_free(cfg);
}
+void test_config_read__corrupt_header2(void)
+{
+ git_config *cfg;
+
+ cl_set_cleanup(&clean_test_config, NULL);
+ cl_git_mkfile("./testconfig", "[unclosed \"bracket\"\n lib = git2\n");
+ cl_git_fail(git_config_open_ondisk(&cfg, "./testconfig"));
+
+ git_config_free(cfg);
+}
+
+void test_config_read__corrupt_header3(void)
+{
+ git_config *cfg;
+
+ cl_set_cleanup(&clean_test_config, NULL);
+ cl_git_mkfile("./testconfig", "[unclosed \"slash\\\"]\n lib = git2\n");
+ cl_git_fail(git_config_open_ondisk(&cfg, "./testconfig"));
+
+ git_config_free(cfg);
+}
+
void test_config_read__override_variable(void)
{
git_config *cfg;
diff --git a/tests-clar/resources/config/config20 b/tests-clar/resources/config/config20
new file mode 100644
index 000000000..8f0f12c4c
--- /dev/null
+++ b/tests-clar/resources/config/config20
@@ -0,0 +1,11 @@
+[valid "[subsection]"]
+ something = a
+; we don't allow anything after closing "
+[sec "[subsec]/child"]
+ parent = grand
+[sec2 "[subsec2]/child2"]
+ type = dvcs
+[sec3 "escape\"quote"]
+ vcs = git
+[sec4 "escaping\\slash"]
+ lib = git2