summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJan Lehnardt <jan@apache.org>2009-01-05 10:38:39 +0000
committerJan Lehnardt <jan@apache.org>2009-01-05 10:38:39 +0000
commit48ad84d64167a97d766904d306376b6b95a4f28f (patch)
treea4aa120c66fefa316c2052edff726e30c44fa21f /test
parent10eac24f530b5de1ea30c83518d3971f99890db6 (diff)
Fix ini-section duplication. When we tried to assign a value to a config-item that happened to be set to that value already, a new and duplicated ini section with that config parameter was written to the ini file.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@731521 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test')
-rw-r--r--test/couch_config_writer_test.erl30
1 files changed, 29 insertions, 1 deletions
diff --git a/test/couch_config_writer_test.erl b/test/couch_config_writer_test.erl
index 39666f5d..aa88abeb 100644
--- a/test/couch_config_writer_test.erl
+++ b/test/couch_config_writer_test.erl
@@ -11,7 +11,8 @@ couch_config_writer_test() ->
fun() -> replace_existing_variable3() end,
fun() -> append_new_variable() end,
fun() -> append_new_module() end,
- fun() -> overwrite_variable_further_down() end
+ fun() -> overwrite_variable_further_down() end,
+ fun() -> double_append_new_section_bug() end
].
@@ -149,6 +150,33 @@ option2 = value2
",
run_operation_and_compare_results(Contents, Expect, [{{"erlang", "option"}, "value"}, {{"erlang", "option2"}, "value2"}]).
+double_append_new_section_bug() ->
+ % create file
+ Contents = "[section]
+variable = value
+
+[another_section]
+another_var = another_value
+
+[erlang]
+option = value
+
+option2 = value2
+",
+
+ Expect = "[section]
+variable = value
+
+[another_section]
+another_var = another_value
+
+[erlang]
+option = value
+
+option2 = value2
+",
+ run_operation_and_compare_results(Contents, Expect, [{{"another_section", "another_var"}, "another_value"}]).
+
run_operation_and_compare_results(Contents, Expect, Config) when not is_list(Config) ->
run_operation_and_compare_results(Contents, Expect, [Config]);