summaryrefslogtreecommitdiff
path: root/tests/scripts/python
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2024-03-04 21:02:03 +0100
committerSébastien Helleu <flashcode@flashtux.org>2024-03-05 19:52:21 +0100
commit84437ab672b6866b7464cda51be91d13f3e2e446 (patch)
tree94dd4f9a0e4e0aadc12cca101759fdf378b200e2 /tests/scripts/python
parent014dc845e8004b323f2c9484cdaaa5c3814642b6 (diff)
downloadweechat-84437ab672b6866b7464cda51be91d13f3e2e446.zip
tests: add tests on scripting API constants
Diffstat (limited to 'tests/scripts/python')
-rw-r--r--tests/scripts/python/testapi.py45
1 files changed, 45 insertions, 0 deletions
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()