summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Doane <jay.s.doane@gmail.com>2018-12-12 19:49:01 -0800
committerJay Doane <jay.s.doane@gmail.com>2018-12-27 13:07:57 -0800
commit4cc956552b8aaa31cec0e454051b19e4a8db5f77 (patch)
treeac587625bc97d0a5aeae91aeba70c80833c78fdf
parentb9b333bac7a2518c2acfde31c47872523ad6e50c (diff)
downloadcouchdb-4cc956552b8aaa31cec0e454051b19e4a8db5f77.tar.gz
Suppress unused function compiler warnings
- Add unused test cases to test fixture - Eliminate unreferenced code - Comment out code that is referenced in commented code only
-rw-r--r--src/couch/test/couch_changes_tests.erl176
-rw-r--r--src/couch/test/couch_doc_json_tests.erl2
-rw-r--r--src/couch/test/couch_flags_tests.erl16
-rw-r--r--src/couch/test/couchdb_vhosts_tests.erl4
4 files changed, 98 insertions, 100 deletions
diff --git a/src/couch/test/couch_changes_tests.erl b/src/couch/test/couch_changes_tests.erl
index e4ea76167..0c2f5f91f 100644
--- a/src/couch/test/couch_changes_tests.erl
+++ b/src/couch/test/couch_changes_tests.erl
@@ -122,17 +122,17 @@ filter_by_design() ->
}
}.
-filter_by_custom_function() ->
- {
- "Filter function",
- {
- foreach,
- fun setup/0, fun teardown/1,
- [
- fun should_receive_heartbeats/1
- ]
- }
- }.
+%% filter_by_custom_function() ->
+%% {
+%% "Filter function",
+%% {
+%% foreach,
+%% fun setup/0, fun teardown/1,
+%% [
+%% fun should_receive_heartbeats/1
+%% ]
+%% }
+%% }.
filter_by_filter_function() ->
{
@@ -547,72 +547,72 @@ should_emit_only_design_documents({DbName, Revs}) ->
Rows2)
end).
-should_receive_heartbeats(_) ->
- {timeout, ?TEST_TIMEOUT div 1000,
- ?_test(
- begin
- DbName = ?tempdb(),
- Timeout = 100,
- {ok, Db} = create_db(DbName),
-
- {ok, _} = save_doc(Db, {[
- {<<"_id">>, <<"_design/filtered">>},
- {<<"language">>, <<"javascript">>},
- {<<"filters">>, {[
- {<<"foo">>, <<"function(doc) {
- return ['doc10', 'doc11', 'doc12'].indexOf(doc._id) != -1;}">>
- }]}}
- ]}),
-
- ChangesArgs = #changes_args{
- filter = "filtered/foo",
- feed = "continuous",
- timeout = 10000,
- heartbeat = 1000
- },
- Consumer = spawn_consumer(DbName, ChangesArgs, {json_req, null}),
-
- {ok, _Rev1} = save_doc(Db, {[{<<"_id">>, <<"doc1">>}]}),
- timer:sleep(Timeout),
- {ok, _Rev2} = save_doc(Db, {[{<<"_id">>, <<"doc2">>}]}),
- timer:sleep(Timeout),
- {ok, _Rev3} = save_doc(Db, {[{<<"_id">>, <<"doc3">>}]}),
- timer:sleep(Timeout),
- {ok, _Rev4} = save_doc(Db, {[{<<"_id">>, <<"doc4">>}]}),
- timer:sleep(Timeout),
- {ok, _Rev5} = save_doc(Db, {[{<<"_id">>, <<"doc5">>}]}),
- timer:sleep(Timeout),
- {ok, _Rev6} = save_doc(Db, {[{<<"_id">>, <<"doc6">>}]}),
- timer:sleep(Timeout),
- {ok, _Rev7} = save_doc(Db, {[{<<"_id">>, <<"doc7">>}]}),
- timer:sleep(Timeout),
- {ok, _Rev8} = save_doc(Db, {[{<<"_id">>, <<"doc8">>}]}),
- timer:sleep(Timeout),
- {ok, _Rev9} = save_doc(Db, {[{<<"_id">>, <<"doc9">>}]}),
-
- Heartbeats = get_heartbeats(Consumer),
- ?assert(Heartbeats > 0),
-
- {ok, _Rev10} = save_doc(Db, {[{<<"_id">>, <<"doc10">>}]}),
- timer:sleep(Timeout),
- {ok, _Rev11} = save_doc(Db, {[{<<"_id">>, <<"doc11">>}]}),
- timer:sleep(Timeout),
- {ok, _Rev12} = save_doc(Db, {[{<<"_id">>, <<"doc12">>}]}),
-
- Heartbeats2 = get_heartbeats(Consumer),
- ?assert(Heartbeats2 > Heartbeats),
-
- Rows = get_rows(Consumer),
- ?assertEqual(3, length(Rows)),
-
- {ok, _Rev13} = save_doc(Db, {[{<<"_id">>, <<"doc13">>}]}),
- timer:sleep(Timeout),
- {ok, _Rev14} = save_doc(Db, {[{<<"_id">>, <<"doc14">>}]}),
- timer:sleep(Timeout),
-
- Heartbeats3 = get_heartbeats(Consumer),
- ?assert(Heartbeats3 > Heartbeats2)
- end)}.
+%% should_receive_heartbeats(_) ->
+%% {timeout, ?TEST_TIMEOUT div 1000,
+%% ?_test(
+%% begin
+%% DbName = ?tempdb(),
+%% Timeout = 100,
+%% {ok, Db} = create_db(DbName),
+
+%% {ok, _} = save_doc(Db, {[
+%% {<<"_id">>, <<"_design/filtered">>},
+%% {<<"language">>, <<"javascript">>},
+%% {<<"filters">>, {[
+%% {<<"foo">>, <<"function(doc) {
+%% return ['doc10', 'doc11', 'doc12'].indexOf(doc._id) != -1;}">>
+%% }]}}
+%% ]}),
+
+%% ChangesArgs = #changes_args{
+%% filter = "filtered/foo",
+%% feed = "continuous",
+%% timeout = 10000,
+%% heartbeat = 1000
+%% },
+%% Consumer = spawn_consumer(DbName, ChangesArgs, {json_req, null}),
+
+%% {ok, _Rev1} = save_doc(Db, {[{<<"_id">>, <<"doc1">>}]}),
+%% timer:sleep(Timeout),
+%% {ok, _Rev2} = save_doc(Db, {[{<<"_id">>, <<"doc2">>}]}),
+%% timer:sleep(Timeout),
+%% {ok, _Rev3} = save_doc(Db, {[{<<"_id">>, <<"doc3">>}]}),
+%% timer:sleep(Timeout),
+%% {ok, _Rev4} = save_doc(Db, {[{<<"_id">>, <<"doc4">>}]}),
+%% timer:sleep(Timeout),
+%% {ok, _Rev5} = save_doc(Db, {[{<<"_id">>, <<"doc5">>}]}),
+%% timer:sleep(Timeout),
+%% {ok, _Rev6} = save_doc(Db, {[{<<"_id">>, <<"doc6">>}]}),
+%% timer:sleep(Timeout),
+%% {ok, _Rev7} = save_doc(Db, {[{<<"_id">>, <<"doc7">>}]}),
+%% timer:sleep(Timeout),
+%% {ok, _Rev8} = save_doc(Db, {[{<<"_id">>, <<"doc8">>}]}),
+%% timer:sleep(Timeout),
+%% {ok, _Rev9} = save_doc(Db, {[{<<"_id">>, <<"doc9">>}]}),
+
+%% Heartbeats = get_heartbeats(Consumer),
+%% ?assert(Heartbeats > 0),
+
+%% {ok, _Rev10} = save_doc(Db, {[{<<"_id">>, <<"doc10">>}]}),
+%% timer:sleep(Timeout),
+%% {ok, _Rev11} = save_doc(Db, {[{<<"_id">>, <<"doc11">>}]}),
+%% timer:sleep(Timeout),
+%% {ok, _Rev12} = save_doc(Db, {[{<<"_id">>, <<"doc12">>}]}),
+
+%% Heartbeats2 = get_heartbeats(Consumer),
+%% ?assert(Heartbeats2 > Heartbeats),
+
+%% Rows = get_rows(Consumer),
+%% ?assertEqual(3, length(Rows)),
+
+%% {ok, _Rev13} = save_doc(Db, {[{<<"_id">>, <<"doc13">>}]}),
+%% timer:sleep(Timeout),
+%% {ok, _Rev14} = save_doc(Db, {[{<<"_id">>, <<"doc14">>}]}),
+%% timer:sleep(Timeout),
+
+%% Heartbeats3 = get_heartbeats(Consumer),
+%% ?assert(Heartbeats3 > Heartbeats2)
+%% end)}.
should_filter_by_doc_attribute({DbName, _}) ->
?_test(
@@ -800,17 +800,17 @@ get_rows({Consumer, _}) ->
?assertNotEqual(timeout, Resp),
Resp.
-get_heartbeats({Consumer, _}) ->
- Ref = make_ref(),
- Consumer ! {get_heartbeats, Ref},
- Resp = receive
- {hearthbeats, Ref, HeartBeats} ->
- HeartBeats
- after ?TIMEOUT ->
- timeout
- end,
- ?assertNotEqual(timeout, Resp),
- Resp.
+%% get_heartbeats({Consumer, _}) ->
+%% Ref = make_ref(),
+%% Consumer ! {get_heartbeats, Ref},
+%% Resp = receive
+%% {hearthbeats, Ref, HeartBeats} ->
+%% HeartBeats
+%% after ?TIMEOUT ->
+%% timeout
+%% end,
+%% ?assertNotEqual(timeout, Resp),
+%% Resp.
clear_rows({Consumer, _}) ->
Ref = make_ref(),
diff --git a/src/couch/test/couch_doc_json_tests.erl b/src/couch/test/couch_doc_json_tests.erl
index bcff0646a..cc5dc3222 100644
--- a/src/couch/test/couch_doc_json_tests.erl
+++ b/src/couch/test/couch_doc_json_tests.erl
@@ -51,6 +51,8 @@ json_doc_test_() ->
fun setup/0, fun teardown/1,
fun(_) ->
[{"Document from JSON", [
+ from_json_with_dbname_error_cases(),
+ from_json_with_db_name_success_cases(),
from_json_success_cases(),
from_json_error_cases()
]},
diff --git a/src/couch/test/couch_flags_tests.erl b/src/couch/test/couch_flags_tests.erl
index a467265cb..cda7639bf 100644
--- a/src/couch/test/couch_flags_tests.erl
+++ b/src/couch/test/couch_flags_tests.erl
@@ -124,14 +124,14 @@ is_enabled() ->
?_assertNot(couch_flags:is_enabled(non_existent, "shards/blacklist/4"))}
]}].
-match_performance() ->
- [{"match_performance", [
- ?_test(begin
- ?debugTime("1 million of operations took", lists:foreach(fun(_) ->
- couch_flags:is_enabled(bar, "shards/test/exact")
- end, lists:seq(1, 1000000)))
- end)
- ]}].
+%% match_performance() ->
+%% [{"match_performance", [
+%% ?_test(begin
+%% ?debugTime("1 million of operations took", lists:foreach(fun(_) ->
+%% couch_flags:is_enabled(bar, "shards/test/exact")
+%% end, lists:seq(1, 1000000)))
+%% end)
+%% ]}].
test_config() ->
diff --git a/src/couch/test/couchdb_vhosts_tests.erl b/src/couch/test/couchdb_vhosts_tests.erl
index 2562a0653..1c4117215 100644
--- a/src/couch/test/couchdb_vhosts_tests.erl
+++ b/src/couch/test/couchdb_vhosts_tests.erl
@@ -270,7 +270,3 @@ should_return_path_for_vhost_with_wildcard_host({Url, DbName}) ->
{reason, ?iofmt("Request failed: ~p", [Else])}]})
end
end).
-
-ensure_index_file() ->
- Body = <<"<!DOCTYPE html>\n<html>\n<body>\nHello world\n</body>\n</html>">>,
- file:write_file(filename:join([?TEMPDIR, "index.html"]), Body).