diff options
author | Jan Lehnardt <jan@apache.org> | 2009-08-29 16:49:22 +0000 |
---|---|---|
committer | Jan Lehnardt <jan@apache.org> | 2009-08-29 16:49:22 +0000 |
commit | 422d815b3baf1a0152429d02257aeaeaf6fa471c (patch) | |
tree | 6f0727dca427ff2c8f71dc0178744976c7d28e54 /test/couch_config_writer_test.erl | |
parent | a09e40659bbdc1ebf41557e0ae2243c7cea0bda7 (diff) |
remove legacy erlang tests, etap covers these
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@809158 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/couch_config_writer_test.erl')
-rw-r--r-- | test/couch_config_writer_test.erl | 209 |
1 files changed, 0 insertions, 209 deletions
diff --git a/test/couch_config_writer_test.erl b/test/couch_config_writer_test.erl deleted file mode 100644 index ba17a946..00000000 --- a/test/couch_config_writer_test.erl +++ /dev/null @@ -1,209 +0,0 @@ -% Licensed under the Apache License, Version 2.0 (the "License"); you may not -% use this file except in compliance with the License. You may obtain a copy of -% the License at -% -% http://www.apache.org/licenses/LICENSE-2.0 -% -% Unless required by applicable law or agreed to in writing, software -% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -% License for the specific language governing permissions and limitations under -% the License. - -% couch_config_writer module test suote - -% Set up test suite -% ?MODULE_test() returns a list of functions -% that run the actual tests. -% todo, fix replace_existing_variable2 (i.e. reordering) -couch_config_writer_test() -> - [ - fun() -> replace_existing_variable() end, - fun() -> replace_existing_variable2() end, - fun() -> replace_existing_variable3() end, - fun() -> append_new_variable() end, - fun() -> append_new_module() end, - fun() -> overwrite_variable_further_down() end, - fun() -> double_append_new_section_bug() end - ]. - - -% test functions -replace_existing_variable() -> - % create file - Contents = "[section] -variable = value - -[another section] -another_var = another_value -", - - Expect = "[section] -variable = new_value - -[another section] -another_var = another_value -", - run_operation_and_compare_results(Contents, Expect, {{"section", "variable"}, "new_value"}). - -replace_existing_variable2() -> - % create file - Contents = "[section] -variable = value -variable2 = value2 -variable3 = value3 -variable4 = value4 - -[another_section] -another_var = another_value -", - - Expect = "[section] -variable = value -variable2 = value2 -variable3 = new_value3 -variable4 = value4 - -[another_section] -another_var = another_value -", - run_operation_and_compare_results(Contents, Expect, {{"section", "variable3"}, "new_value3"}). - -replace_existing_variable3() -> - % create file - Contents = "[first_section] -var=val - -[section] -variable = value -variable2 = value2 -variable3 = value3 -variable4 = value4 - -[another_section] -another_var = another_value -", - - Expect = "[first_section] -var=val - -[section] -variable = value -variable2 = value2 -variable3 = new_value3 -variable4 = value4 - -[another_section] -another_var = another_value -", - run_operation_and_compare_results(Contents, Expect, {{"section", "variable3"}, "new_value3"}). - -append_new_variable() -> - % create file - Contents = "[section] -variable = value -variable2 = value - -[another_section] -another_var = another_value -", - - Expect = "[section] -variable = value -variable2 = value - -fantasy_variable = Citation Needed - -[another_section] -another_var = another_value -", - run_operation_and_compare_results(Contents, Expect, {{"section", "fantasy_variable"}, "Citation Needed"}). - - -append_new_module() -> - % create file - Contents = "[section] -variable = value - -[another_section] -another_var = another_value -", - - Expect = "[section] -variable = value - -[another_section] -another_var = another_value - -[one_more_section] -favourite_food = cupcakes -", - run_operation_and_compare_results(Contents, Expect, [{{"one_more_section", "favourite_food"}, "cupcakes"}]). - -overwrite_variable_further_down() -> - % create file - Contents = "[section] -variable = value - -[another_section] -another_var = another_value -", - - Expect = "[section] -variable = value - -[another_section] -another_var = another_value - -[erlang] -option = value - -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]); -run_operation_and_compare_results(Contents, Expect, Config) -> - Filename = "local.ini", - file:write_file(Filename, Contents), - - % call replace function - [couch_config_writer:save_to_file(ConfigVar, Filename) || ConfigVar <- Config], - - % compare new file with expected file - {ok, Result_} = file:read_file(Filename), - Result = binary_to_list(Result_), - - % clean up - % file:delete(Filename), - - Result = Expect. |