summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJan Lehnardt <jan@apache.org>2009-08-29 16:49:22 +0000
committerJan Lehnardt <jan@apache.org>2009-08-29 16:49:22 +0000
commit422d815b3baf1a0152429d02257aeaeaf6fa471c (patch)
tree6f0727dca427ff2c8f71dc0178744976c7d28e54 /test
parenta09e40659bbdc1ebf41557e0ae2243c7cea0bda7 (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')
-rw-r--r--test/Makefile.am5
-rw-r--r--test/couch_config_test.erl44
-rw-r--r--test/couch_config_writer_test.erl209
-rw-r--r--test/runner.erl79
-rwxr-xr-xtest/runner.sh4
5 files changed, 0 insertions, 341 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index 7f41c649..f06b325b 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -12,11 +12,6 @@
dist_TESTS = runner.sh
-CLEANFILES = runner.beam test.ini
-
EXTRA_DIST = \
- couch_config_test.erl \
- couch_config_writer_test.erl \
- runner.erl \
runner.sh \
test.js
diff --git a/test/couch_config_test.erl b/test/couch_config_test.erl
deleted file mode 100644
index 096ce53d..00000000
--- a/test/couch_config_test.erl
+++ /dev/null
@@ -1,44 +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 module test suite
-
-% Set up test suite
-% ?MODULE_test() returns a list of functions
-% that run the actual tests.
-couch_config_test() ->
- [
- fun() -> store_strings() end
- ].
-
-% test functions
-
-store_strings() ->
- Filename = "test.ini",
- file:write_file(Filename, ""),
-
- Key = "foo",
- Value = "bar",
-
- {ok, Proc} = couch_config:start_link([Filename]),
-
- couch_config:set("test_module", Key, Value),
- Result = couch_config:get("test_module", Key),
- couch_config:delete("test_module", Key),
-
- exit(Proc, kill),
- receive {'EXIT', Proc, _} -> ok end,
-
- % clean up
- file:delete(Filename),
-
- Value = Result.
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.
diff --git a/test/runner.erl b/test/runner.erl
deleted file mode 100644
index f2522d2d..00000000
--- a/test/runner.erl
+++ /dev/null
@@ -1,79 +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.
-
--module(runner).
-
--export([run/0]).
--include("couch_config_test.erl").
--include("couch_config_writer_test.erl").
-
-%% Test Runner
-run() ->
- % mochiweb tests
- % case mochiweb:test() of
- % ok ->
- % io:format("Mochiweb Tests PASSED~n");
- % _ ->
- % io:format("Mochiweb Tests FAILED~n")
- % end,
-
- % CouchDB tests
- Tests = lists:flatten([
- couch_config_test(),
- couch_config_writer_test()
- ]),
- run_tests(Tests),
-
- % we're done, get out of here
- halt().
-
-run_test(TestFun) ->
- io:format(" ~s ", [proplists:get_value(
- name,
- erlang:fun_info(TestFun))]),
- try TestFun() of
- _ ->
- io:format("[PASSED]~n", []),
- passed
- catch
- _:{skipped, Reason} ->
- io:format("[SKIPPED]~n", []),
- io:format(" reason: ~s~n", [Reason]),
- skipped;
- _:X ->
- io:format("[FAILED]~n", []),
- io:format("ERROR: ~n======~n~p ~n======~n~n",
- [{X, erlang:get_stacktrace()}]),
- failed
- end.
-
-run_tests(List) ->
- io:format("Running ~p tests...~n", [lists:flatlength(List)]),
-
- Results = lists:map(fun run_test/1, List),
-
- Passed = lists:filter(
- fun (Result) -> Result =:= passed end,
- Results),
-
- Failed = lists:filter(
- fun (Result) -> Result =:= failed end,
- Results),
-
- Skipped = lists:filter(
- fun(Result) -> Result =:= skipped end,
- Results),
-
- io:format("PASSED: ~p, FAILED: ~p, SKIPPED: ~p ~n",
- [lists:flatlength(Passed),
- lists:flatlength(Failed),
- lists:flatlength(Skipped)]).
diff --git a/test/runner.sh b/test/runner.sh
index e1936b7e..1f48c390 100755
--- a/test/runner.sh
+++ b/test/runner.sh
@@ -12,10 +12,6 @@
# License for the specific language governing permissions and limitations under
# the License.
-erlc runner.erl
-
-erl -noshell -pa ../src/couchdb -pa ../src/mochiweb -eval "runner:run()"
-
cat ../share/www/script/couch.js \
../share/www/script/couch_test_runner.js \
../share/www/script/couch_tests.js \