You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by mi...@apache.org on 2015/06/03 13:37:53 UTC
[2/3] config commit: updated
refs/heads/2708-stronger-testing-for-config-set to ee652d2
[squash] Add tests for add stronger config set/get/delete testing
Project: http://git-wip-us.apache.org/repos/asf/couchdb-config/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-config/commit/6566dd43
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-config/tree/6566dd43
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-config/diff/6566dd43
Branch: refs/heads/2708-stronger-testing-for-config-set
Commit: 6566dd43c6f2a6bc8c5c737be2c41477833a3065
Parents: f695b78
Author: Mike Wallace <mi...@apache.org>
Authored: Wed Jun 3 12:16:58 2015 +0100
Committer: Mike Wallace <mi...@apache.org>
Committed: Wed Jun 3 12:37:03 2015 +0100
----------------------------------------------------------------------
test/config_tests.erl | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-config/blob/6566dd43/test/config_tests.erl
----------------------------------------------------------------------
diff --git a/test/config_tests.erl b/test/config_tests.erl
index c823d3e..778e383 100644
--- a/test/config_tests.erl
+++ b/test/config_tests.erl
@@ -116,7 +116,7 @@ config_get_tests() ->
should_return_undefined_atom_on_missed_option(),
should_return_custom_default_value_on_missed_option(),
should_only_return_default_on_missed_option(),
- should_fail_to_get_binary_value(),
+ should_fail_to_get_non_string_value(),
should_return_any_supported_default()
]
}
@@ -131,7 +131,7 @@ config_set_tests() ->
[
should_update_option(),
should_create_new_section(),
- should_fail_to_set_binary_value()
+ should_fail_to_set_non_string_value()
]
}
}.
@@ -144,7 +144,8 @@ config_del_tests() ->
fun setup/0, fun teardown/1,
[
should_return_undefined_atom_after_option_deletion(),
- should_be_ok_on_deleting_unknown_options()
+ should_be_ok_on_deleting_unknown_options(),
+ should_fail_to_delete_non_string_value()
]
}
}.
@@ -243,9 +244,11 @@ should_only_return_default_on_missed_option() ->
?_assertEqual("0",
config:get("httpd", "port", "bar")).
-should_fail_to_get_binary_value() ->
+should_fail_to_get_non_string_value() ->
?_assertException(error, badarg,
- config:get(<<"foo">>, <<"bar">>, <<"baz">>)).
+ config:get(<<"foo">>, <<"bar">>, <<"baz">>)),
+ ?_assertException(error, badarg,
+ config:get([f, o, o], [b, a, r], [b, a, z])).
should_return_any_supported_default() ->
Values = [undefined, "list", true, false, 0.1, 1],
@@ -269,9 +272,11 @@ should_create_new_section() ->
config:get("new_section", "bizzle")
end).
-should_fail_to_set_binary_value() ->
+should_fail_to_set_non_string_value() ->
+ ?_assertException(error, badarg,
+ config:set(<<"foo">>, <<"bar">>, <<"baz">>, false)),
?_assertException(error, badarg,
- config:set(<<"foo">>, <<"bar">>, <<"baz">>, false)).
+ config:set([f, o, o], [b, a, r], [b, a, z], false)).
should_return_undefined_atom_after_option_deletion() ->
?_assertEqual(undefined,
@@ -283,6 +288,12 @@ should_return_undefined_atom_after_option_deletion() ->
should_be_ok_on_deleting_unknown_options() ->
?_assertEqual(ok, config:delete("zoo", "boo", false)).
+should_fail_to_delete_non_string_value() ->
+ ?_assertException(error, badarg,
+ config:delete(<<"foo">>, <<"bar">>, false)),
+ ?_assertException(error, badarg,
+ config:delete([f, o, o], [b, a, r], false)).
+
should_ensure_in_defaults(_, _) ->
?_test(begin
?assertEqual("500",