From 84437ab672b6866b7464cda51be91d13f3e2e446 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Mon, 4 Mar 2024 21:02:03 +0100 Subject: tests: add tests on scripting API constants --- tests/scripts/python/testapi.py | 45 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'tests/scripts') diff --git a/tests/scripts/python/testapi.py b/tests/scripts/python/testapi.py index 06745a9a6..de3023bb3 100644 --- a/tests/scripts/python/testapi.py +++ b/tests/scripts/python/testapi.py @@ -42,6 +42,50 @@ def check(result, condition, lineno): condition) +def test_constants(): + """Test constants.""" + check(weechat.WEECHAT_RC_OK == 0) + check(weechat.WEECHAT_RC_OK_EAT == 1) + check(weechat.WEECHAT_RC_ERROR == -1) + check(weechat.WEECHAT_CONFIG_READ_OK == 0) + check(weechat.WEECHAT_CONFIG_READ_MEMORY_ERROR == -1) + check(weechat.WEECHAT_CONFIG_READ_FILE_NOT_FOUND == -2) + check(weechat.WEECHAT_CONFIG_WRITE_OK == 0) + check(weechat.WEECHAT_CONFIG_WRITE_ERROR == -1) + check(weechat.WEECHAT_CONFIG_WRITE_MEMORY_ERROR == -2) + check(weechat.WEECHAT_CONFIG_OPTION_SET_OK_CHANGED == 2) + check(weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE == 1) + check(weechat.WEECHAT_CONFIG_OPTION_SET_ERROR == 0) + check(weechat.WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND == -1) + check(weechat.WEECHAT_CONFIG_OPTION_UNSET_OK_NO_RESET == 0) + check(weechat.WEECHAT_CONFIG_OPTION_UNSET_OK_RESET == 1) + check(weechat.WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED == 2) + check(weechat.WEECHAT_CONFIG_OPTION_UNSET_ERROR == -1) + check(weechat.WEECHAT_LIST_POS_SORT == 'sort') + check(weechat.WEECHAT_LIST_POS_BEGINNING == 'beginning') + check(weechat.WEECHAT_LIST_POS_END == 'end') + check(weechat.WEECHAT_HOTLIST_LOW == '0') + check(weechat.WEECHAT_HOTLIST_MESSAGE == '1') + check(weechat.WEECHAT_HOTLIST_PRIVATE == '2') + check(weechat.WEECHAT_HOTLIST_HIGHLIGHT == '3') + check(weechat.WEECHAT_HOOK_PROCESS_RUNNING == -1) + check(weechat.WEECHAT_HOOK_PROCESS_ERROR == -2) + check(weechat.WEECHAT_HOOK_CONNECT_OK == 0) + check(weechat.WEECHAT_HOOK_CONNECT_ADDRESS_NOT_FOUND == 1) + check(weechat.WEECHAT_HOOK_CONNECT_IP_ADDRESS_NOT_FOUND == 2) + check(weechat.WEECHAT_HOOK_CONNECT_CONNECTION_REFUSED == 3) + check(weechat.WEECHAT_HOOK_CONNECT_PROXY_ERROR == 4) + check(weechat.WEECHAT_HOOK_CONNECT_LOCAL_HOSTNAME_ERROR == 5) + check(weechat.WEECHAT_HOOK_CONNECT_GNUTLS_INIT_ERROR == 6) + check(weechat.WEECHAT_HOOK_CONNECT_GNUTLS_HANDSHAKE_ERROR == 7) + check(weechat.WEECHAT_HOOK_CONNECT_MEMORY_ERROR == 8) + check(weechat.WEECHAT_HOOK_CONNECT_TIMEOUT == 9) + check(weechat.WEECHAT_HOOK_CONNECT_SOCKET_ERROR == 10) + check(weechat.WEECHAT_HOOK_SIGNAL_STRING == 'string') + check(weechat.WEECHAT_HOOK_SIGNAL_INT == 'int') + check(weechat.WEECHAT_HOOK_SIGNAL_POINTER == 'pointer') + + def test_plugins(): """Test plugins functions.""" check(weechat.plugin_get_name('') == 'core') @@ -747,6 +791,7 @@ def cmd_test_cb(data, buf, args): weechat.prnt('', '>>> ------------------------------') weechat.prnt('', '>>> Testing ' + '{SCRIPT_LANGUAGE}' + ' API') weechat.prnt('', ' > TESTS: ' + '{SCRIPT_TESTS}') + test_constants() test_plugins() test_strings() test_lists() -- cgit v1.2.3