You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2022/08/28 04:45:10 UTC
[couchdb] branch fix-variable-bound-warnings created (now c5022cf03)
This is an automated email from the ASF dual-hosted git repository.
jaydoane pushed a change to branch fix-variable-bound-warnings
in repository https://gitbox.apache.org/repos/asf/couchdb.git
at c5022cf03 Fix variable already bound compiler warnings
This branch includes the following new commits:
new c5022cf03 Fix variable already bound compiler warnings
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[couchdb] 01/01: Fix variable already bound compiler warnings
Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jaydoane pushed a commit to branch fix-variable-bound-warnings
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit c5022cf03ae4c1addeb13ac61db07e9c5588c0fc
Author: Jay Doane <ja...@apache.org>
AuthorDate: Tue Aug 23 22:36:35 2022 -0700
Fix variable already bound compiler warnings
OTP 25 generates warnings like the following:
src/chttpd/test/eunit/chttpd_util_test.erl:33:48: Warning: variable '_Persist' is already bound. If you mean to ignore this value, use '_' or a different underscore-prefixed name
Create an explicit `Persist` variable set `false` to suppress those warnings.
---
src/chttpd/test/eunit/chttpd_csp_tests.erl | 7 ++--
.../test/eunit/chttpd_db_attachment_size_tests.erl | 5 ++-
src/chttpd/test/eunit/chttpd_delayed_test.erl | 5 ++-
src/chttpd/test/eunit/chttpd_session_tests.erl | 10 +++--
src/chttpd/test/eunit/chttpd_util_test.erl | 46 +++++++++++-----------
5 files changed, 40 insertions(+), 33 deletions(-)
diff --git a/src/chttpd/test/eunit/chttpd_csp_tests.erl b/src/chttpd/test/eunit/chttpd_csp_tests.erl
index 4c77c5ab0..c4a9e930e 100644
--- a/src/chttpd/test/eunit/chttpd_csp_tests.erl
+++ b/src/chttpd/test/eunit/chttpd_csp_tests.erl
@@ -223,9 +223,10 @@ setup() ->
DbName.
cleanup(DbName) ->
- config:delete("csp", "utils_enable", _Persist = false),
- config:delete("csp", "attachments_enable", _Persist = false),
- config:delete("csp", "showlist_enable", _Persist = false),
+ Persist = false,
+ config:delete("csp", "utils_enable", Persist),
+ config:delete("csp", "attachments_enable", Persist),
+ config:delete("csp", "showlist_enable", Persist),
DbUrl = base_url() ++ "/" ++ DbName,
{200, _} = req(delete, ?ADM, DbUrl),
UsersDb = config:get("chttpd_auth", "authentication_db"),
diff --git a/src/chttpd/test/eunit/chttpd_db_attachment_size_tests.erl b/src/chttpd/test/eunit/chttpd_db_attachment_size_tests.erl
index e3975bb6e..6e886935a 100644
--- a/src/chttpd/test/eunit/chttpd_db_attachment_size_tests.erl
+++ b/src/chttpd/test/eunit/chttpd_db_attachment_size_tests.erl
@@ -23,8 +23,9 @@
setup() ->
Hashed = couch_passwords:hash_admin_password(?PASS),
- ok = config:set("admins", ?USER, ?b2l(Hashed), _Persist = false),
- ok = config:set("couchdb", "max_attachment_size", "50", _Persist = false),
+ Persist = false,
+ ok = config:set("admins", ?USER, ?b2l(Hashed), Persist),
+ ok = config:set("couchdb", "max_attachment_size", "50", Persist),
TmpDb = ?tempdb(),
Addr = config:get("chttpd", "bind_address", "127.0.0.1"),
Port = integer_to_list(mochiweb_socket_server:get(chttpd, port)),
diff --git a/src/chttpd/test/eunit/chttpd_delayed_test.erl b/src/chttpd/test/eunit/chttpd_delayed_test.erl
index 4b0fbd55b..a6ee6b3f1 100644
--- a/src/chttpd/test/eunit/chttpd_delayed_test.erl
+++ b/src/chttpd/test/eunit/chttpd_delayed_test.erl
@@ -19,8 +19,9 @@
setup() ->
Hashed = couch_passwords:hash_admin_password(?PASS),
- ok = config:set("admins", ?USER, ?b2l(Hashed), _Persist = false),
- ok = config:set("chttpd", "buffer_response", "true", _Persist = false),
+ Persist = false,
+ ok = config:set("admins", ?USER, ?b2l(Hashed), Persist),
+ ok = config:set("chttpd", "buffer_response", "true", Persist),
TmpDb = ?tempdb(),
Addr = config:get("chttpd", "bind_address", "127.0.0.1"),
Port = mochiweb_socket_server:get(chttpd, port),
diff --git a/src/chttpd/test/eunit/chttpd_session_tests.erl b/src/chttpd/test/eunit/chttpd_session_tests.erl
index 3d99e3b10..e00406fe1 100644
--- a/src/chttpd/test/eunit/chttpd_session_tests.erl
+++ b/src/chttpd/test/eunit/chttpd_session_tests.erl
@@ -19,14 +19,16 @@
-define(PASS, "pass").
setup() ->
- ok = config:delete("chttpd_auth", "authentication_db", _Persist = false),
+ Persist = false,
+ ok = config:delete("chttpd_auth", "authentication_db", Persist),
Hashed = couch_passwords:hash_admin_password(?PASS),
- ok = config:set("admins", ?USER, binary_to_list(Hashed), _Persist = false),
+ ok = config:set("admins", ?USER, binary_to_list(Hashed), Persist),
root_url() ++ "/_session".
cleanup(_) ->
- ok = config:delete("chttpd_auth", "authentication_db", _Persist = false),
- ok = config:delete("admins", ?USER, _Persist = false).
+ Persist = false,
+ ok = config:delete("chttpd_auth", "authentication_db", Persist),
+ ok = config:delete("admins", ?USER, Persist).
session_test_() ->
{
diff --git a/src/chttpd/test/eunit/chttpd_util_test.erl b/src/chttpd/test/eunit/chttpd_util_test.erl
index 4ad2b8b83..69fb60156 100644
--- a/src/chttpd/test/eunit/chttpd_util_test.erl
+++ b/src/chttpd/test/eunit/chttpd_util_test.erl
@@ -23,36 +23,38 @@ setup() ->
["httpd", "chttpd", "couch_httpd_auth", "chttpd_auth"]
),
+ Persist = false,
ok = config:set(
"httpd",
"authentication_handlers",
"{couch_httpd_auth, cookie_authentication_handler}, "
"{couch_httpd_auth, default_authentication_handler}",
- _Persist = false
+ Persist
),
- ok = config:set("httpd", "backlog", "512", _Persist = false),
- ok = config:set("chttpd", "require_valid_user", "false", _Persist = false),
- ok = config:set("httpd", "both_exist", "get_in_httpd", _Persist = false),
- ok = config:set("chttpd", "both_exist", "get_in_chttpd", _Persist = false),
- ok = config:set("httpd", "httpd_only", "true", _Persist = false),
- ok = config:set("chttpd", "chttpd_only", "1", _Persist = false),
- ok = config:set("couch_httpd_auth", "both_exist", "cha", _Persist = false),
- ok = config:set("chttpd_auth", "both_exist", "ca", _Persist = false),
- ok = config:set("couch_httpd_auth", "cha_only", "true", _Persist = false),
- ok = config:set("chttpd_auth", "ca_only", "1", _Persist = false).
+ ok = config:set("httpd", "backlog", "512", Persist),
+ ok = config:set("chttpd", "require_valid_user", "false", Persist),
+ ok = config:set("httpd", "both_exist", "get_in_httpd", Persist),
+ ok = config:set("chttpd", "both_exist", "get_in_chttpd", Persist),
+ ok = config:set("httpd", "httpd_only", "true", Persist),
+ ok = config:set("chttpd", "chttpd_only", "1", Persist),
+ ok = config:set("couch_httpd_auth", "both_exist", "cha", Persist),
+ ok = config:set("chttpd_auth", "both_exist", "ca", Persist),
+ ok = config:set("couch_httpd_auth", "cha_only", "true", Persist),
+ ok = config:set("chttpd_auth", "ca_only", "1", Persist).
teardown(_) ->
- ok = config:delete("httpd", "authentication_handlers", _Persist = false),
- ok = config:delete("httpd", "backlog", _Persist = false),
- ok = config:delete("chttpd", "require_valid_user", _Persist = false),
- ok = config:delete("httpd", "both_exist", _Persist = false),
- ok = config:delete("chttpd", "both_exist", _Persist = false),
- ok = config:delete("httpd", "httpd_only", _Persist = false),
- ok = config:delete("chttpd", "chttpd_only", _Persist = false),
- ok = config:delete("couch_httpd_auth", "both_exist", _Persist = false),
- ok = config:delete("chttpd_auth", "both_exist", _Persist = false),
- ok = config:delete("couch_httpd_auth", "cha_only", _Persist = false),
- ok = config:delete("chttpd_auth", "ca_only", _Persist = false).
+ Persist = false,
+ ok = config:delete("httpd", "authentication_handlers", Persist),
+ ok = config:delete("httpd", "backlog", Persist),
+ ok = config:delete("chttpd", "require_valid_user", Persist),
+ ok = config:delete("httpd", "both_exist", Persist),
+ ok = config:delete("chttpd", "both_exist", Persist),
+ ok = config:delete("httpd", "httpd_only", Persist),
+ ok = config:delete("chttpd", "chttpd_only", Persist),
+ ok = config:delete("couch_httpd_auth", "both_exist", Persist),
+ ok = config:delete("chttpd_auth", "both_exist", Persist),
+ ok = config:delete("couch_httpd_auth", "cha_only", Persist),
+ ok = config:delete("chttpd_auth", "ca_only", Persist).
config_delete_all_keys(Section) ->
lists:foreach(