mirror of
https://github.com/weechat/weechat.git
synced 2026-06-12 14:14:48 +02:00
tests: add tests on scripting API constants
This commit is contained in:
@@ -43,6 +43,10 @@ Bug fixes::
|
||||
* tcl: fix truncation of long integer returned by function hdata_long
|
||||
* trigger: fix memory leak when adding a new trigger with `/trigger` command
|
||||
|
||||
Tests::
|
||||
|
||||
* scripts: add tests on constants
|
||||
|
||||
Build::
|
||||
|
||||
* tcl: make plugin compatible with Tcl 9.0 (issue #2075)
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user