config: Add test cases that have trailing spaces before comment chars
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
diff --git a/tests/config/stress.c b/tests/config/stress.c
index 488915e..e8e9d2b 100644
--- a/tests/config/stress.c
+++ b/tests/config/stress.c
@@ -44,12 +44,24 @@ void test_config_stress__comments(void)
cl_git_pass(git_config_open_ondisk(&config, cl_fixture("config/config12")));
+ cl_git_pass(git_config_get_string(&str, config, "some.section.test2"));
+ cl_assert_equal_s("hello", str);
+
+ cl_git_pass(git_config_get_string(&str, config, "some.section.test3"));
+ cl_assert_equal_s("welcome", str);
+
cl_git_pass(git_config_get_string(&str, config, "some.section.other"));
cl_assert_equal_s("hello! \" ; ; ; ", str);
+ cl_git_pass(git_config_get_string(&str, config, "some.section.other2"));
+ cl_assert_equal_s("cool! \" # # # ", str);
+
cl_git_pass(git_config_get_string(&str, config, "some.section.multi"));
cl_assert_equal_s("hi, this is a ; multiline comment # with ;\n special chars and other stuff !@#", str);
+ cl_git_pass(git_config_get_string(&str, config, "some.section.multi2"));
+ cl_assert_equal_s("good, this is a ; multiline comment # with ;\n special chars and other stuff !@#", str);
+
cl_git_pass(git_config_get_string(&str, config, "some.section.back"));
cl_assert_equal_s("this is \ba phrase", str);
diff --git a/tests/resources/config/config12 b/tests/resources/config/config12
index b57a81b..6917880 100644
--- a/tests/resources/config/config12
+++ b/tests/resources/config/config12
@@ -1,7 +1,13 @@
[some "section"]
test = hi ; comment
+ test2 = hello ; comment
+ test3 = welcome #comment
other = "hello! \" ; ; ; " ; more test
+ other2 = "cool! \" # # # " # more test
multi = "hi, this is a ; \
multiline comment # with ;\n special chars \
and other stuff !@#"
+ multi2 = "good, this is a ; \
+multiline comment # with ;\n special chars \
+and other stuff !@#" #^^^
back = "this is \ba phrase"