tests: add tests on typing plugin functions

This commit is contained in:
Sébastien Helleu 2021-07-04 11:38:45 +02:00
parent 8dc75564c2
commit 7c83ee02f2
10 changed files with 532 additions and 216 deletions

View File

@ -389,54 +389,57 @@ WeeChat "core" is located in following directories:
[width="100%",cols="2m,3",options="header"]
|===
| Path/file | Description
| tests/ | Root of tests.
|    tests.cpp | Program used to run all tests.
|    scripts/ | Root of scripting API tests.
|       test-scripts.cpp | Program used to run the scripting API tests.
|       python/ | Python scripts to generate and run the scripting API tests.
|          testapigen.py | Python script generating scripts in all languages to test the scripting API.
|          testapi.py | Python script with scripting API tests, used by script testapigen.py.
|          unparse.py | Convert Python code to other languages, used by script testapigen.py.
|    unit/ | Root of unit tests.
|       test-plugins.cpp | Tests: plugins.
|       core/ | Root of unit tests for core.
|          test-core-arraylist.cpp | Tests: arraylists.
|          test-core-calc.cpp | Tests: calculation of expressions.
|          test-core-crypto.cpp | Tests: cryptographic functions.
|          test-core-dir.cpp | Tests: directory/file functions.
|          test-core-eval.cpp | Tests: evaluation of expressions.
|          test-core-hashtble.cpp | Tests: hashtables.
|          test-core-hdata.cpp | Tests: hdata.
|          test-core-hook.cpp | Tests: hooks.
|          test-core-infolist.cpp | Tests: infolists.
|          test-core-list.cpp | Tests: lists.
|          test-core-network.cpp | Tests: network functions.
|          test-core-secure.cpp | Tests: secured data.
|          test-core-signal.cpp | Tests: signals.
|          test-core-string.cpp | Tests: strings.
|          test-core-url.cpp | Tests: URLs.
|          test-core-utf8.cpp | Tests: UTF-8.
|          test-core-util.cpp | Tests: utility functions.
|       gui/ | Root of unit tests for interfaces.
|          test-gui-color.cpp | Tests: colors.
|          test-gui-line.cpp | Tests: lines.
|          test-gui-nick.cpp | Tests: nicks.
|       plugins/ | Root of unit tests for plugins.
|          irc/ | Root of unit tests for IRC plugin.
|             test-irc-channel.cpp | Tests: IRC channels.
|             test-irc-color.cpp | Tests: IRC colors.
|             test-irc-config.cpp | Tests: IRC configuration.
|             test-irc-ignore.cpp | Tests: IRC ignores.
|             test-irc-message.cpp | Tests: IRC messages.
|             test-irc-mode.cpp | Tests: IRC modes.
|             test-irc-nick.cpp | Tests: IRC nicks.
|             test-irc-protocol.cpp | Tests: IRC protocol.
|             test-irc-server.cpp | Tests: IRC server.
|          trigger/ | Root of unit tests for trigger plugin.
|             test-trigger.cpp | Tests: triggers.
|          relay/ | Root of unit tests for Relay plugin.
|             test-relay-auth.cpp | Tests: clients authentication.
| Path/file | Description
| tests/ | Root of tests.
|    tests.cpp | Program used to run all tests.
|    scripts/ | Root of scripting API tests.
|       test-scripts.cpp | Program used to run the scripting API tests.
|       python/ | Python scripts to generate and run the scripting API tests.
|          testapigen.py | Python script generating scripts in all languages to test the scripting API.
|          testapi.py | Python script with scripting API tests, used by script testapigen.py.
|          unparse.py | Convert Python code to other languages, used by script testapigen.py.
|    unit/ | Root of unit tests.
|       test-plugins.cpp | Tests: plugins.
|       core/ | Root of unit tests for core.
|          test-core-arraylist.cpp | Tests: arraylists.
|          test-core-calc.cpp | Tests: calculation of expressions.
|          test-core-crypto.cpp | Tests: cryptographic functions.
|          test-core-dir.cpp | Tests: directory/file functions.
|          test-core-eval.cpp | Tests: evaluation of expressions.
|          test-core-hashtble.cpp | Tests: hashtables.
|          test-core-hdata.cpp | Tests: hdata.
|          test-core-hook.cpp | Tests: hooks.
|          test-core-infolist.cpp | Tests: infolists.
|          test-core-list.cpp | Tests: lists.
|          test-core-network.cpp | Tests: network functions.
|          test-core-secure.cpp | Tests: secured data.
|          test-core-signal.cpp | Tests: signals.
|          test-core-string.cpp | Tests: strings.
|          test-core-url.cpp | Tests: URLs.
|          test-core-utf8.cpp | Tests: UTF-8.
|          test-core-util.cpp | Tests: utility functions.
|       gui/ | Root of unit tests for interfaces.
|          test-gui-color.cpp | Tests: colors.
|          test-gui-line.cpp | Tests: lines.
|          test-gui-nick.cpp | Tests: nicks.
|       plugins/ | Root of unit tests for plugins.
|          irc/ | Root of unit tests for IRC plugin.
|             test-irc-channel.cpp | Tests: IRC channels.
|             test-irc-color.cpp | Tests: IRC colors.
|             test-irc-config.cpp | Tests: IRC configuration.
|             test-irc-ignore.cpp | Tests: IRC ignores.
|             test-irc-message.cpp | Tests: IRC messages.
|             test-irc-mode.cpp | Tests: IRC modes.
|             test-irc-nick.cpp | Tests: IRC nicks.
|             test-irc-protocol.cpp | Tests: IRC protocol.
|             test-irc-server.cpp | Tests: IRC server.
|          trigger/ | Root of unit tests for trigger plugin.
|             test-trigger.cpp | Tests: triggers.
|          typing/ | Root of unit tests for typing plugin.
|             test-typing.cpp | Tests: typing.
|             test-typing-status.cpp | Tests: typing status.
|          relay/ | Root of unit tests for Relay plugin.
|             test-relay-auth.cpp | Tests: clients authentication.
|===

View File

@ -391,54 +391,57 @@ Le cœur de WeeChat est situé dans les répertoires suivants :
[width="100%",cols="2m,3",options="header"]
|===
| Chemin/fichier | Description
| tests/ | Racine des tests.
|    tests.cpp | Programme utilisé pour lancer tous les tests.
|    scripts/ | Racine des tests de l'API script.
|       test-scripts.cpp | Programme utilisé pour lancer les tests de l'API script.
|       python/ | Scripts Python pour générer et lancer les tests de l'API script.
|          testapigen.py | Script Python générant des scripts dans tous les languages pour tester l'API script.
|          testapi.py | Script Python avec les tests API, utilisé par le script testapigen.py.
|          unparse.py | Conversion de code Python vers d'autres langages, utilisé par le script testapigen.py.
|    unit/ | Racine des tests unitaires.
|       test-plugins.cpp | Tests : extensions.
|       core/ | Racine des tests unitaires pour le cœur.
|          test-core-arraylist.cpp | Tests : listes avec tableau (« arraylists »).
|          test-core-calc.cpp | Tests : calcul d'expressions.
|          test-core-crypto.cpp | Tests : fonctions cryptographiques.
|          test-core-dir.cpp | Tests : répertoires/fichiers.
|          test-core-eval.cpp | Tests : évaluation d'expressions.
|          test-core-hashtble.cpp | Tests : tables de hachage.
|          test-core-hdata.cpp | Tests : hdata.
|          test-core-hook.cpp | Tests : hooks.
|          test-core-infolist.cpp | Tests : infolists.
|          test-core-list.cpp | Tests : listes.
|          test-core-network.cpp | Tests : fonctions réseau.
|          test-core-secure.cpp | Tests : données sécurisées.
|          test-core-signal.cpp | Tests : signaux.
|          test-core-string.cpp | Tests : chaînes.
|          test-core-url.cpp | Tests : URLs.
|          test-core-utf8.cpp | Tests : UTF-8.
|          test-core-util.cpp | Tests : fonctions utiles.
|       gui/ | Racine des tests unitaires pour les interfaces.
|          test-gui-color.cpp | Tests : couleurs.
|          test-gui-line.cpp | Tests : lignes.
|          test-gui-nick.cpp | Tests : pseudos.
|       plugins/ | Racine des tests unitaires pour les extensions.
|          irc/ | Racine des tests unitaires pour l'extension IRC.
|             test-irc-channel.cpp | Tests : canaux IRC.
|             test-irc-color.cpp | Tests : couleurs IRC.
|             test-irc-config.cpp | Tests : configuration IRC.
|             test-irc-ignore.cpp | Tests : ignores IRC.
|             test-irc-message.cpp | Tests : messages IRC.
|             test-irc-mode.cpp | Tests : modes IRC.
|             test-irc-nick.cpp | Tests : pseudos IRC.
|             test-irc-protocol.cpp | Tests : protocole IRC.
|             test-irc-server.cpp | Tests : serveur IRC.
|          trigger/ | Racine des tests unitaires pour l'extension trigger.
|             test-trigger.cpp | Tests : triggers.
|          relay/ | Racine des tests unitaires pour l'extension Relay.
|             test-relay-auth.cpp | Tests : authentification des clients.
| Chemin/fichier | Description
| tests/ | Racine des tests.
|    tests.cpp | Programme utilisé pour lancer tous les tests.
|    scripts/ | Racine des tests de l'API script.
|       test-scripts.cpp | Programme utilisé pour lancer les tests de l'API script.
|       python/ | Scripts Python pour générer et lancer les tests de l'API script.
|          testapigen.py | Script Python générant des scripts dans tous les languages pour tester l'API script.
|          testapi.py | Script Python avec les tests API, utilisé par le script testapigen.py.
|          unparse.py | Conversion de code Python vers d'autres langages, utilisé par le script testapigen.py.
|    unit/ | Racine des tests unitaires.
|       test-plugins.cpp | Tests : extensions.
|       core/ | Racine des tests unitaires pour le cœur.
|          test-core-arraylist.cpp | Tests : listes avec tableau (« arraylists »).
|          test-core-calc.cpp | Tests : calcul d'expressions.
|          test-core-crypto.cpp | Tests : fonctions cryptographiques.
|          test-core-dir.cpp | Tests : répertoires/fichiers.
|          test-core-eval.cpp | Tests : évaluation d'expressions.
|          test-core-hashtble.cpp | Tests : tables de hachage.
|          test-core-hdata.cpp | Tests : hdata.
|          test-core-hook.cpp | Tests : hooks.
|          test-core-infolist.cpp | Tests : infolists.
|          test-core-list.cpp | Tests : listes.
|          test-core-network.cpp | Tests : fonctions réseau.
|          test-core-secure.cpp | Tests : données sécurisées.
|          test-core-signal.cpp | Tests : signaux.
|          test-core-string.cpp | Tests : chaînes.
|          test-core-url.cpp | Tests : URLs.
|          test-core-utf8.cpp | Tests : UTF-8.
|          test-core-util.cpp | Tests : fonctions utiles.
|       gui/ | Racine des tests unitaires pour les interfaces.
|          test-gui-color.cpp | Tests : couleurs.
|          test-gui-line.cpp | Tests : lignes.
|          test-gui-nick.cpp | Tests : pseudos.
|       plugins/ | Racine des tests unitaires pour les extensions.
|          irc/ | Racine des tests unitaires pour l'extension IRC.
|             test-irc-channel.cpp | Tests : canaux IRC.
|             test-irc-color.cpp | Tests : couleurs IRC.
|             test-irc-config.cpp | Tests : configuration IRC.
|             test-irc-ignore.cpp | Tests : ignores IRC.
|             test-irc-message.cpp | Tests : messages IRC.
|             test-irc-mode.cpp | Tests : modes IRC.
|             test-irc-nick.cpp | Tests : pseudos IRC.
|             test-irc-protocol.cpp | Tests : protocole IRC.
|             test-irc-server.cpp | Tests : serveur IRC.
|          trigger/ | Racine des tests unitaires pour l'extension trigger.
|             test-trigger.cpp | Tests : triggers.
|          typing/ | Racine des tests unitaires pour l'extension typing.
|             test-typing.cpp | Tests : typing.
|             test-typing-status.cpp | Tests : statut d'écriture.
|          relay/ | Racine des tests unitaires pour l'extension Relay.
|             test-relay-auth.cpp | Tests : authentification des clients.
|===
[[documentation_translations]]

View File

@ -408,71 +408,77 @@ WeeChat "core" は以下のディレクトリに配置されています:
[width="100%",cols="2m,3",options="header"]
|===
| パス/ファイル名 | 説明
| tests/ | テスト用のルートディレクトリ
|    tests.cpp | 全テストの実行時に使われるプログラム
|    scripts/ | スクリプト API テスト用のルートディレクトリ
|       test-scripts.cpp | スクリプト API テストの実行時に使われるプログラム
|       python/ | スクリプト API テストを生成、実行する Python スクリプト
|          testapigen.py | スクリプト API のテスト時にすべての言語に関するスクリプトを生成する Python スクリプト
|          testapi.py | スクリプト API テスト時に使われる Python スクリプト (スクリプト testapigen.py から使われます)
|          unparse.py | Python コードを別の言語に変換 (スクリプト testapigen.py から使われます)
|    unit/ | 単体テスト用のルートディレクトリ
|       test-plugins.cpp | テスト: プラグイン
|       core/ | core 向け単体テスト用のルートディレクトリ
|          test-core-arraylist.cpp | テスト: 配列リスト
| パス/ファイル名 | 説明
| tests/ | テスト用のルートディレクトリ
|    tests.cpp | 全テストの実行時に使われるプログラム
|    scripts/ | スクリプト API テスト用のルートディレクトリ
|       test-scripts.cpp | スクリプト API テストの実行時に使われるプログラム
|       python/ | スクリプト API テストを生成、実行する Python スクリプト
|          testapigen.py | スクリプト API のテスト時にすべての言語に関するスクリプトを生成する Python スクリプト
|          testapi.py | スクリプト API テスト時に使われる Python スクリプト (スクリプト testapigen.py から使われます)
|          unparse.py | Python コードを別の言語に変換 (スクリプト testapigen.py から使われます)
|    unit/ | 単体テスト用のルートディレクトリ
|       test-plugins.cpp | テスト: プラグイン
|       core/ | core 向け単体テスト用のルートディレクトリ
|          test-core-arraylist.cpp | テスト: 配列リスト
// TRANSLATION MISSING
|          test-core-calc.cpp | Tests: calculation of expressions.
|          test-core-calc.cpp | Tests: calculation of expressions.
// TRANSLATION MISSING
|          test-core-crypto.cpp | Tests: cryptographic functions.
|          test-core-crypto.cpp | Tests: cryptographic functions.
// TRANSLATION MISSING
|          test-core-dir.cpp | Tests: directory/file functions.
|          test-core-eval.cpp | テスト: 式の評価
|          test-core-hashtble.cpp | テスト: ハッシュテーブル
|          test-core-hdata.cpp | テスト: hdata
|          test-core-hook.cpp | テスト: フック
|          test-core-infolist.cpp | テスト: インフォリスト
|          test-core-list.cpp | テスト: リスト
|          test-core-dir.cpp | Tests: directory/file functions.
|          test-core-eval.cpp | テスト: 式の評価
|          test-core-hashtble.cpp | テスト: ハッシュテーブル
|          test-core-hdata.cpp | テスト: hdata
|          test-core-hook.cpp | テスト: フック
|          test-core-infolist.cpp | テスト: インフォリスト
|          test-core-list.cpp | テスト: リスト
// TRANSLATION MISSING
|          test-core-network.cpp | Tests: network functions.
|          test-core-secure.cpp | テスト: データ保護
|          test-core-network.cpp | Tests: network functions.
|          test-core-secure.cpp | テスト: データ保護
// TRANSLATION MISSING
|          test-core-signal.cpp | テスト: signals.
|          test-core-string.cpp | テスト: 文字列
|          test-core-url.cpp | テスト: URL
|          test-core-utf8.cpp | テスト: UTF-8
|          test-core-util.cpp | テスト: ユーティリティ関数
|       gui/ | インターフェースの単体テストを収める最上位ディレクトリ
|          test-core-signal.cpp | テスト: signals.
|          test-core-string.cpp | テスト: 文字列
|          test-core-url.cpp | テスト: URL
|          test-core-utf8.cpp | テスト: UTF-8
|          test-core-util.cpp | テスト: ユーティリティ関数
|       gui/ | インターフェースの単体テストを収める最上位ディレクトリ
// TRANSLATION MISSING
|          test-gui-color.cpp | Tests: colors.
|          test-gui-line.cpp | テスト: 行
|          test-gui-color.cpp | Tests: colors.
|          test-gui-line.cpp | テスト: 行
// TRANSLATION MISSING
|          test-gui-nick.cpp | テスト: nicks
|       plugins/ | プラグインの単体テストを収める最上位ディレクトリ
|          irc/ | IRC プラグインの単体テストを収める最上位ディレクトリ
|          test-gui-nick.cpp | テスト: nicks
|       plugins/ | プラグインの単体テストを収める最上位ディレクトリ
|          irc/ | IRC プラグインの単体テストを収める最上位ディレクトリ
// TRANSLATION MISSING
|             test-irc-channel.cpp | Tests: IRC channels.
|             test-irc-color.cpp | Tests: IRC colors.
|             test-irc-config.cpp | テスト: IRC 設定
|             test-irc-channel.cpp | Tests: IRC channels.
|             test-irc-color.cpp | Tests: IRC colors.
|             test-irc-config.cpp | テスト: IRC 設定
// TRANSLATION MISSING
|             test-irc-ignore.cpp | Tests: IRC ignores.
|             test-irc-ignore.cpp | Tests: IRC ignores.
// TRANSLATION MISSING
|             test-irc-message.cpp | Tests: IRC messages.
|             test-irc-message.cpp | Tests: IRC messages.
// TRANSLATION MISSING
|             test-irc-mode.cpp | Tests: IRC modes.
|             test-irc-mode.cpp | Tests: IRC modes.
// TRANSLATION MISSING
|             test-irc-nick.cpp | Tests: IRC nicks.
|             test-irc-protocol.cpp | テスト: IRC プロトコル
|             test-irc-nick.cpp | Tests: IRC nicks.
|             test-irc-protocol.cpp | テスト: IRC プロトコル
// TRANSLATION MISSING
|             test-irc-server.cpp | Tests: IRC server.
|             test-irc-server.cpp | Tests: IRC server.
// TRANSLATION MISSING
|          trigger/ | Root of unit tests for trigger plugin.
|          trigger/ | Root of unit tests for trigger plugin.
// TRANSLATION MISSING
|             test-trigger.cpp | Tests: triggers.
|             test-trigger.cpp | Tests: triggers.
// TRANSLATION MISSING
|          relay/ | Root of unit tests for Relay plugin.
|          typing/ | Root of unit tests for typing plugin.
// TRANSLATION MISSING
|             test-relay-auth.cpp | Tests: clients authentication.
|             test-typing.cpp | Tests: typing.
// TRANSLATION MISSING
|             test-typing-status.cpp | Tests: typing status.
// TRANSLATION MISSING
|          relay/ | Root of unit tests for Relay plugin.
// TRANSLATION MISSING
|             test-relay-auth.cpp | Tests: clients authentication.
|===
[[documentation_translations]]

View File

@ -395,54 +395,60 @@ WeeChat „језгро” се налази у следећим директо
[width="100%", cols="2m,3", options="header"]
|===
| Путања/фајл | Опис
| tests/ | Корен тестова.
|    tests.cpp | Програм који се користи за извршавање свих тестова.
|    scripts/ | Корен тестова за API скриптовања.
|       test-scripts.cpp | Програм који се користи за извршавање тестова API скриптовања.
|       python/ | Python скрипте које генеришу и покрећу тестове API скриптовања.
|          testapigen.py | Python скрипта која генерише скрипте на свим језицима за тестирање API скриптовања.
|          testapi.py | Python скрипта са тестовима API скриптовања, користи је скрипта testapigen.py.
|          unparse.py | Конверзија Python кода у остале језике, користи је скрипта testapigen.py.
|    unit/ | Корен unit тестова.
|       test-plugins.cpp | Тестови: plugins.
|       core/ | Корен unit тестова језгра.
|          test-core-arraylist.cpp | Тестови: arraylists.
|          test-core-calc.cpp | Тестови: калкулација израза.
|          test-core-crypto.cpp | Тестови: криптографске функције.
|          test-core-dir.cpp | Тестови: функције директоријума/фајла.
|          test-core-eval.cpp | Тестови: израчунавање израза.
|          test-core-hashtble.cpp | Тестови: hashtables.
|          test-core-hdata.cpp | Тестови: hdata.
|          test-core-hook.cpp | Тестови: куке.
|          test-core-infolist.cpp | Тестови: infolists.
|          test-core-list.cpp | Тестови: листе.
|          test-core-network.cpp | Тестови: мрежне функције.
|          test-core-secure.cpp | Тестови: обезбеђени подаци.
|          test-core-signal.cpp | Тестови: сигнали.
|          test-core-string.cpp | Тестови: стрингови.
|          test-core-url.cpp | Тестови: URL адресе.
|          test-core-utf8.cpp | Тестови: UTF-8.
|          test-core-util.cpp | Тестови: помоћне функције.
|       gui/ | Корен unit тестова интерфејса.
|          test-gui-color.cpp | Тестови: боје.
|          test-gui-line.cpp | Тестови: линије.
|          test-gui-nick.cpp | Тестови: надимци.
|       plugins/ | Корен unit тестова додатака.
|          irc/ | Корен unit тестова IRC додатка.
|             test-irc-channel.cpp | Тестови: IRC канали.
|             test-irc-color.cpp | Тестови: IRC боје.
|             test-irc-config.cpp | Тестови: IRC конфигурација.
|             test-irc-ignore.cpp | Тестови: IRC игнорисања.
|             test-irc-message.cpp | Тестови: IRC поруке.
|             test-irc-mode.cpp | Тестови: IRC режими.
|             test-irc-nick.cpp | Тестови: IRC надимци.
|             test-irc-protocol.cpp | Тестови: IRC протокол.
|             test-irc-server.cpp | Тестови: IRC сервер.
|          trigger/ | Корен unit тестова за окидач додатак.
|             test-trigger.cpp | Тестови: окидачи.
|          relay/ | Корен unit тестова за Релеј додатак.
|             test-relay-auth.cpp | Тестови: аутентификација клијената.
| Путања/фајл | Опис
| tests/ | Корен тестова.
|    tests.cpp | Програм који се користи за извршавање свих тестова.
|    scripts/ | Корен тестова за API скриптовања.
|       test-scripts.cpp | Програм који се користи за извршавање тестова API скриптовања.
|       python/ | Python скрипте које генеришу и покрећу тестове API скриптовања.
|          testapigen.py | Python скрипта која генерише скрипте на свим језицима за тестирање API скриптовања.
|          testapi.py | Python скрипта са тестовима API скриптовања, користи је скрипта testapigen.py.
|          unparse.py | Конверзија Python кода у остале језике, користи је скрипта testapigen.py.
|    unit/ | Корен unit тестова.
|       test-plugins.cpp | Тестови: plugins.
|       core/ | Корен unit тестова језгра.
|          test-core-arraylist.cpp | Тестови: arraylists.
|          test-core-calc.cpp | Тестови: калкулација израза.
|          test-core-crypto.cpp | Тестови: криптографске функције.
|          test-core-dir.cpp | Тестови: функције директоријума/фајла.
|          test-core-eval.cpp | Тестови: израчунавање израза.
|          test-core-hashtble.cpp | Тестови: hashtables.
|          test-core-hdata.cpp | Тестови: hdata.
|          test-core-hook.cpp | Тестови: куке.
|          test-core-infolist.cpp | Тестови: infolists.
|          test-core-list.cpp | Тестови: листе.
|          test-core-network.cpp | Тестови: мрежне функције.
|          test-core-secure.cpp | Тестови: обезбеђени подаци.
|          test-core-signal.cpp | Тестови: сигнали.
|          test-core-string.cpp | Тестови: стрингови.
|          test-core-url.cpp | Тестови: URL адресе.
|          test-core-utf8.cpp | Тестови: UTF-8.
|          test-core-util.cpp | Тестови: помоћне функције.
|       gui/ | Корен unit тестова интерфејса.
|          test-gui-color.cpp | Тестови: боје.
|          test-gui-line.cpp | Тестови: линије.
|          test-gui-nick.cpp | Тестови: надимци.
|       plugins/ | Корен unit тестова додатака.
|          irc/ | Корен unit тестова IRC додатка.
|             test-irc-channel.cpp | Тестови: IRC канали.
|             test-irc-color.cpp | Тестови: IRC боје.
|             test-irc-config.cpp | Тестови: IRC конфигурација.
|             test-irc-ignore.cpp | Тестови: IRC игнорисања.
|             test-irc-message.cpp | Тестови: IRC поруке.
|             test-irc-mode.cpp | Тестови: IRC режими.
|             test-irc-nick.cpp | Тестови: IRC надимци.
|             test-irc-protocol.cpp | Тестови: IRC протокол.
|             test-irc-server.cpp | Тестови: IRC сервер.
|          trigger/ | Корен unit тестова за окидач додатак.
|             test-trigger.cpp | Тестови: окидачи.
// TRANSLATION MISSING
|          typing/ | Root of unit tests for typing plugin.
// TRANSLATION MISSING
|             test-typing.cpp | Tests: typing.
// TRANSLATION MISSING
|             test-typing-status.cpp | Tests: typing status.
|          relay/ | Корен unit тестова за Релеј додатак.
|             test-relay-auth.cpp | Тестови: аутентификација клијената.
|===

View File

@ -53,6 +53,9 @@ typing_status_search_state (const char *state)
{
int i;
if (!state)
return -1;
for (i = 0; i < TYPING_STATUS_NUM_STATES; i++)
{
if (strcmp (typing_status_state_string[i], state) == 0)
@ -297,6 +300,27 @@ typing_status_nick_add (struct t_gui_buffer *buffer, const char *nick,
return ptr_typing_status;
}
/*
* Searches a nick typing status for a buffer.
*
* Returns pointer to t_typing_status found, NULL if not found.
*/
struct t_typing_status *
typing_status_nick_search (struct t_gui_buffer *buffer, const char *nick)
{
struct t_hashtable *ptr_nicks;
if (!typing_status_nicks || !buffer || !nick)
return NULL;
ptr_nicks = weechat_hashtable_get (typing_status_nicks, buffer);
if (!ptr_nicks)
return NULL;
return weechat_hashtable_get (ptr_nicks, nick);
}
/*
* Removes a nick typing status from a buffer.
*
@ -320,27 +344,6 @@ typing_status_nick_remove (struct t_gui_buffer *buffer, const char *nick)
weechat_hashtable_remove (ptr_nicks, nick);
}
/*
* Searches a nick typing status for a buffer.
*
* Returns pointer to t_typing_status found, NULL if not found.
*/
struct t_typing_status *
typing_status_nick_search (struct t_gui_buffer *buffer, const char *nick)
{
struct t_hashtable *ptr_nicks;
if (!typing_status_nicks)
return NULL;
ptr_nicks = weechat_hashtable_get (typing_status_nicks, buffer);
if (!ptr_nicks)
return NULL;
return weechat_hashtable_get (ptr_nicks, nick);
}
/*
* Ends typing status.
*/

View File

@ -40,6 +40,7 @@ struct t_typing_status
time_t last_typed; /* when was last char typed */
};
extern char *typing_status_state_string[];
extern struct t_hashtable *typing_status_self;
extern struct t_hashtable *typing_status_nicks;
@ -52,10 +53,10 @@ extern struct t_typing_status *typing_status_nick_add (struct t_gui_buffer *buff
const char *nick,
int state,
int last_typed);
extern void typing_status_nick_remove (struct t_gui_buffer *buffer,
const char *nick);
extern struct t_typing_status *typing_status_nick_search (struct t_gui_buffer *buffer,
const char *nick);
extern void typing_status_nick_remove (struct t_gui_buffer *buffer,
const char *nick);
extern void typing_status_end ();
#endif /* WEECHAT_PLUGIN_TYPING_STATUS_H */

View File

@ -78,6 +78,13 @@ if(ENABLE_TRIGGER)
)
endif()
if(ENABLE_TYPING)
list(APPEND LIB_WEECHAT_UNIT_TESTS_PLUGINS_SRC
unit/plugins/typing/test-typing.cpp
unit/plugins/typing/test-typing-status.cpp
)
endif()
add_library(weechat_unit_tests_plugins MODULE ${LIB_WEECHAT_UNIT_TESTS_PLUGINS_SRC})
if(ICONV_LIBRARY)

View File

@ -88,10 +88,16 @@ if PLUGIN_TRIGGER
tests_trigger = unit/plugins/trigger/test-trigger.cpp
endif
if PLUGIN_TYPING
tests_typing = unit/plugins/typing/test-typing.cpp \
unit/plugins/typing/test-typing-status.cpp
endif
lib_weechat_unit_tests_plugins_la_SOURCES = unit/plugins/test-plugins.cpp \
$(tests_irc) \
$(tests_relay) \
$(tests_trigger)
$(tests_trigger) \
$(tests_typing)
lib_weechat_unit_tests_plugins_la_LDFLAGS = -module -no-undefined

View File

@ -0,0 +1,137 @@
/*
* test-typing-status.cpp - test typing status functions
*
* Copyright (C) 2021 Sébastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
* WeeChat is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* WeeChat is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
*/
#include "CppUTest/TestHarness.h"
extern "C"
{
#include "src/core/wee-hashtable.h"
#include "src/gui/gui-buffer.h"
#include "src/plugins/typing/typing-status.h"
}
#include "tests/tests.h"
TEST_GROUP(TypingStatus)
{
};
/*
* Tests functions:
* typing_status_search_state
*/
TEST(TypingStatus, SearchState)
{
int i;
LONGS_EQUAL(-1, typing_status_search_state (NULL));
LONGS_EQUAL(-1, typing_status_search_state (""));
LONGS_EQUAL(-1, typing_status_search_state ("abc"));
for (i = 0; i < TYPING_STATUS_NUM_STATES; i++)
{
LONGS_EQUAL(i, typing_status_search_state (typing_status_state_string[i]));
}
}
/*
* Tests functions:
* typing_status_self_free_value_cb
* typing_status_self_add
* typing_status_self_search
*/
TEST(TypingStatus, SelfAddSearch)
{
struct t_typing_status *ptr_typing_status;
POINTERS_EQUAL(NULL, typing_status_self_add (NULL, 0, 0));
POINTERS_EQUAL(NULL, typing_status_self_add (NULL, -1, 0));
POINTERS_EQUAL(NULL, typing_status_self_add (gui_buffers, -1, 0));
POINTERS_EQUAL(NULL, typing_status_self_add (gui_buffers, 999999, 0));
ptr_typing_status = typing_status_self_add (gui_buffers,
TYPING_STATUS_STATE_TYPING,
1625390031);
CHECK(ptr_typing_status);
LONGS_EQUAL(TYPING_STATUS_STATE_TYPING, ptr_typing_status->state);
LONGS_EQUAL(1625390031, ptr_typing_status->last_typed);
LONGS_EQUAL(1, typing_status_self->items_count);
POINTERS_EQUAL(gui_buffers, typing_status_self->oldest_item->key);
POINTERS_EQUAL(ptr_typing_status, typing_status_self->oldest_item->value);
POINTERS_EQUAL(NULL, typing_status_self->oldest_item->next_created_item);
POINTERS_EQUAL(NULL, typing_status_self_search (NULL));
POINTERS_EQUAL(NULL, typing_status_self_search (gui_buffers + 1));
POINTERS_EQUAL(ptr_typing_status, typing_status_self_search (gui_buffers));
hashtable_remove_all (typing_status_self);
}
/*
* Tests functions:
* typing_status_nicks_free_value_cb
* typing_status_nick_free_value_cb
* typing_status_nick_add
* typing_status_nick_search
* typing_status_nick_remove
*/
TEST(TypingStatus, NickAddSearchRemove)
{
struct t_typing_status *ptr_typing_status;
struct t_hashtable *ptr_nicks;
POINTERS_EQUAL(NULL, typing_status_nick_add (NULL, NULL, 0, 0));
POINTERS_EQUAL(NULL, typing_status_nick_add (NULL, "test", 0, 0));
POINTERS_EQUAL(NULL, typing_status_nick_add (NULL, "test", -1, 0));
POINTERS_EQUAL(NULL, typing_status_nick_add (NULL, "test", 999999, 0));
POINTERS_EQUAL(NULL, typing_status_nick_add (gui_buffers, NULL, -1, 0));
POINTERS_EQUAL(NULL, typing_status_nick_add (gui_buffers, "test", -1, 0));
POINTERS_EQUAL(NULL, typing_status_nick_add (gui_buffers, "test", 999999, 0));
ptr_typing_status = typing_status_nick_add (gui_buffers,
"alice",
TYPING_STATUS_STATE_TYPING,
1625390031);
CHECK(ptr_typing_status);
LONGS_EQUAL(TYPING_STATUS_STATE_TYPING, ptr_typing_status->state);
LONGS_EQUAL(1625390031, ptr_typing_status->last_typed);
LONGS_EQUAL(1, typing_status_nicks->items_count);
POINTERS_EQUAL(gui_buffers, typing_status_nicks->oldest_item->key);
POINTERS_EQUAL(NULL, typing_status_nicks->oldest_item->next_created_item);
ptr_nicks = (struct t_hashtable *)hashtable_get (typing_status_nicks,
gui_buffers);
LONGS_EQUAL(1, ptr_nicks->items_count);
STRCMP_EQUAL("alice", (const char *)ptr_nicks->oldest_item->key);
POINTERS_EQUAL(ptr_typing_status, ptr_nicks->oldest_item->value);
POINTERS_EQUAL(NULL, ptr_nicks->oldest_item->next_created_item);
POINTERS_EQUAL(NULL, typing_status_nick_search (NULL, NULL));
POINTERS_EQUAL(NULL, typing_status_nick_search (gui_buffers, NULL));
POINTERS_EQUAL(NULL, typing_status_nick_search (gui_buffers, "abc"));
POINTERS_EQUAL(ptr_typing_status, typing_status_nick_search (gui_buffers,
"alice"));
hashtable_remove_all (typing_status_nicks);
}

View File

@ -0,0 +1,144 @@
/*
* test-typing.cpp - test typing functions
*
* Copyright (C) 2021 Sébastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
* WeeChat is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* WeeChat is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
*/
#include "CppUTest/TestHarness.h"
extern "C"
{
#include "src/plugins/typing/typing.h"
}
#include "tests/tests.h"
TEST_GROUP(Typing)
{
};
/*
* Tests functions:
* typing_send_signal
*/
TEST(Typing, SendSignal)
{
/* TODO: write tests */
}
/*
* Tests functions:
* typing_buffer_closing_signal_cb
*/
TEST(Typing, BufferClosingSignalCb)
{
/* TODO: write tests */
}
/*
* Tests functions:
* typing_input_text_changed_signal_cb
*/
TEST(Typing, InputTextChangedSignalCb)
{
/* TODO: write tests */
}
/*
* Tests functions:
* typing_input_text_for_buffer_modifier_cb
*/
TEST(Typing, InputTextForBufferModifierCb)
{
/* TODO: write tests */
}
/*
* Tests functions:
* typing_status_self_status_map_cb
*/
TEST(Typing, StatusSelfStatusMapCb)
{
/* TODO: write tests */
}
/*
* Tests functions:
* typing_status_nicks_status_map_cb
*/
TEST(Typing, StatusNicksStatusMapCb)
{
/* TODO: write tests */
}
/*
* Tests functions:
* typing_status_nicks_hash_map_cb
*/
TEST(Typing, StatusNicksHashMapCb)
{
/* TODO: write tests */
}
/*
* Tests functions:
* typing_timer_cb
*/
TEST(Typing, TimerCb)
{
/* TODO: write tests */
}
/*
* Tests functions:
* typing_typing_set_nick_signal_cb
*/
TEST(Typing, TypingSetNickSignalCb)
{
/* TODO: write tests */
}
/*
* Tests functions:
* typing_typing_reset_buffer_signal_cb
*/
TEST(Typing, TypingResetBufferSignalCb)
{
/* TODO: write tests */
}
/*
* Tests functions:
* typing_setup_hooks
*/
TEST(Typing, SetupHooks)
{
/* TODO: write tests */
}