diff --git a/doc/en/weechat_dev.en.adoc b/doc/en/weechat_dev.en.adoc index 50b54bcf4..6df5daccd 100644 --- a/doc/en/weechat_dev.en.adoc +++ b/doc/en/weechat_dev.en.adoc @@ -396,91 +396,95 @@ 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. -|    tests-record.cpp | Record and search in messages displayed. -|    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. -|       test-plugin-api-info.cpp | Tests: plugin API info functions. -|       test-plugin-config.cpp | Tests: plugin config functions. -|       core/ | Root of unit tests for core. -|          test-core-arraylist.cpp | Tests: arraylists. -|          test-core-calc.cpp | Tests: calculation of expressions. -|          test-core-command.cpp | Tests: commands. -|          test-core-config-file.cpp | Tests: configuration files. -|          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. -|          test-core-sys.cpp | Tests: system functions. -|          hook/ | Root of unit tests for hooks. -|             test-hook-command.cpp | Tests: hooks "command". -|       gui/ | Root of unit tests for interfaces. -|          test-gui-bar-window.cpp | Tests: bar window functions. -|          test-gui-buffer.cpp | Tests: buffer functions. -|          test-gui-chat.cpp | Tests: chat functions. -|          test-gui-color.cpp | Tests: colors. -|          test-gui-filter.cpp | Tests: filters. -|          test-gui-input.cpp | Tests: input functions. -|          test-gui-key.cpp | Tests: keys. -|          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-batch.cpp | Tests: IRC batched events. -|             test-irc-buffer.cpp | Tests: IRC buffers. -|             test-irc-channel.cpp | Tests: IRC channels. -|             test-irc-color.cpp | Tests: IRC colors. -|             test-irc-config.cpp | Tests: IRC configuration. -|             test-irc-ctcp.cpp | Tests: IRC CTCP. -|             test-irc-ignore.cpp | Tests: IRC ignores. -|             test-irc-info.cpp | Tests: IRC info. -|             test-irc-join.cpp | Tests: IRC join functions. -|             test-irc-list.cpp | Tests: IRC buffer for reply to /list command. -|             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-sasl.cpp | Tests: SASL authentication with IRC protocol. -|             test-irc-server.cpp | Tests: IRC server. -|             test-irc-tag.cpp | Tests: IRC message tags. -|          logger/ | Root of unit tests for logger plugin. -|             test-logger.cpp | Tests: logger. -|             test-logger-backlog.cpp | Tests: logger backlog. -|             test-logger-tail.cpp | Tests: logger tail functions. -|          trigger/ | Root of unit tests for trigger plugin. -|             test-trigger.cpp | Tests: triggers. -|             test-trigger-config.cpp | Tests: trigger configuration. -|          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. -|             test-relay-http.cpp | Tests: HTTP functions for Relay plugin. -|             test-relay-websocket.cpp | Tests: websocket functions for Relay plugin. -|             irc/ | Root of unit tests for Relay "irc" protocol. -|                test-relay-irc.cpp | Tests: Relay "irc" protocol. -|          xfer/ | Root of unit tests for Xfer plugin. -|             test-xfer-file.cpp | Tests: file functions. -|             test-xfer-network.cpp | Tests: network functions. +| Path/file | Description +| tests/ | Root of tests. +|    tests.cpp | Program used to run all tests. +|    tests-record.cpp | Record and search in messages displayed. +|    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. +|       test-plugin-api-info.cpp | Tests: plugin API info functions. +|       test-plugin-config.cpp | Tests: plugin config functions. +|       core/ | Root of unit tests for core. +|          test-core-arraylist.cpp | Tests: arraylists. +|          test-core-calc.cpp | Tests: calculation of expressions. +|          test-core-command.cpp | Tests: commands. +|          test-core-config-file.cpp | Tests: configuration files. +|          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. +|          test-core-sys.cpp | Tests: system functions. +|          hook/ | Root of unit tests for hooks. +|             test-hook-command.cpp | Tests: hooks "command". +|       gui/ | Root of unit tests for interfaces. +|          test-gui-bar-window.cpp | Tests: bar window functions. +|          test-gui-buffer.cpp | Tests: buffer functions. +|          test-gui-chat.cpp | Tests: chat functions. +|          test-gui-color.cpp | Tests: colors. +|          test-gui-filter.cpp | Tests: filters. +|          test-gui-input.cpp | Tests: input functions. +|          test-gui-key.cpp | Tests: keys. +|          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-batch.cpp | Tests: IRC batched events. +|             test-irc-buffer.cpp | Tests: IRC buffers. +|             test-irc-channel.cpp | Tests: IRC channels. +|             test-irc-color.cpp | Tests: IRC colors. +|             test-irc-config.cpp | Tests: IRC configuration. +|             test-irc-ctcp.cpp | Tests: IRC CTCP. +|             test-irc-ignore.cpp | Tests: IRC ignores. +|             test-irc-info.cpp | Tests: IRC info. +|             test-irc-join.cpp | Tests: IRC join functions. +|             test-irc-list.cpp | Tests: IRC buffer for reply to /list command. +|             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-sasl.cpp | Tests: SASL authentication with IRC protocol. +|             test-irc-server.cpp | Tests: IRC server. +|             test-irc-tag.cpp | Tests: IRC message tags. +|          logger/ | Root of unit tests for logger plugin. +|             test-logger.cpp | Tests: logger. +|             test-logger-backlog.cpp | Tests: logger backlog. +|             test-logger-tail.cpp | Tests: logger tail functions. +|          trigger/ | Root of unit tests for trigger plugin. +|             test-trigger.cpp | Tests: triggers. +|             test-trigger-config.cpp | Tests: trigger configuration. +|          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. +|             test-relay-http.cpp | Tests: HTTP functions for Relay plugin. +|             test-relay-websocket.cpp | Tests: websocket functions for Relay plugin. +|             api/ | Root of unit tests for Relay "api" protocol. +|                test-relay-api.cpp | Tests: Relay "api" protocol: general functions. +|                test-relay-api-msg.cpp | Tests: Relay "api" protocol: messages. +|                test-relay-api-protocol.cpp | Tests: Relay "api" protocol: protocol. +|             irc/ | Root of unit tests for Relay "irc" protocol. +|                test-relay-irc.cpp | Tests: Relay "irc" protocol. +|          xfer/ | Root of unit tests for Xfer plugin. +|             test-xfer-file.cpp | Tests: file functions. +|             test-xfer-network.cpp | Tests: network functions. |=== [[documentation_translations]] diff --git a/doc/fr/weechat_dev.fr.adoc b/doc/fr/weechat_dev.fr.adoc index 51fb1045a..7b2f7c281 100644 --- a/doc/fr/weechat_dev.fr.adoc +++ b/doc/fr/weechat_dev.fr.adoc @@ -398,91 +398,95 @@ 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. -|    tests-record.cpp | Enregistrement et recherche dans les messages affichés. -|    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. -|       test-plugin-api-info.cpp | Tests : fonctions info de l'API extension. -|       test-plugin-config.cpp | Tests : fonctions config de l'extension. -|       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-command.cpp | Tests : commandes. -|          test-core-config-file.cpp | Tests : fichiers de configuration. -|          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. -|          test-core-sys.cpp | Tests : fonctions système. -|          hook/ | Racine des tests pour les hooks. -|             test-hook-command.cpp | Tests : hooks "command". -|       gui/ | Racine des tests unitaires pour les interfaces. -|          test-gui-bar-window.cpp | Tests : fonctions de fenêtres de barre. -|          test-gui-buffer.cpp | Tests : fonctions de tampons. -|          test-gui-chat.cpp | Tests : fonctions de discussion. -|          test-gui-color.cpp | Tests : couleurs. -|          test-gui-filter.cpp | Tests : filtres. -|          test-gui-input.cpp | Tests : fonctions d'entrée. -|          test-gui-key.cpp | Tests : touches. -|          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-batch.cpp | Tests : évènements batch IRC. -|             test-irc-buffer.cpp | Tests : tampons IRC. -|             test-irc-channel.cpp | Tests : canaux IRC. -|             test-irc-color.cpp | Tests : couleurs IRC. -|             test-irc-config.cpp | Tests : configuration IRC. -|             test-irc-ctcp.cpp | Tests : CTCP IRC. -|             test-irc-ignore.cpp | Tests : ignores IRC. -|             test-irc-info.cpp | Tests : infos IRC. -|             test-irc-join.cpp | Tests : fonctions de join IRC. -|             test-irc-list.cpp | Tests : tampon IRC pour la réponse à la commande /list. -|             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-sasl.cpp | Tests : authentification SASL avec le protocole IRC. -|             test-irc-server.cpp | Tests : serveur IRC. -|             test-irc-tag.cpp | Tests : étiquettes des messages IRC. -|          logger/ | Racine des tests unitaires pour l'extension logger. -|             test-logger.cpp | Tests : logger. -|             test-logger-backlog.cpp | Tests : backlog logger. -|             test-logger-tail.cpp | Tests : fonctions "tail". -|          trigger/ | Racine des tests unitaires pour l'extension trigger. -|             test-trigger.cpp | Tests : triggers. -|             test-trigger-config.cpp | Tests : configuration trigger. -|          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. -|             test-relay-http.cpp | Tests : fonctions HTTP pour l'extension Relay. -|             test-relay-websocket.cpp | Tests : fonctions websocket pour l'extension Relay. -|             irc/ | Racine des tests unitaires pour le protocole relay "irc". -|                test-relay-irc.cpp | Tests : Protocole relay "irc". -|          xfer/ | Racine des tests unitaires pour l'extension Xfer. -|             test-xfer-file.cpp | Tests : fonctions sur les fichiers. -|             test-xfer-network.cpp | Tests : fonctions réseau. +| Chemin/fichier | Description +| tests/ | Racine des tests. +|    tests.cpp | Programme utilisé pour lancer tous les tests. +|    tests-record.cpp | Enregistrement et recherche dans les messages affichés. +|    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. +|       test-plugin-api-info.cpp | Tests : fonctions info de l'API extension. +|       test-plugin-config.cpp | Tests : fonctions config de l'extension. +|       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-command.cpp | Tests : commandes. +|          test-core-config-file.cpp | Tests : fichiers de configuration. +|          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. +|          test-core-sys.cpp | Tests : fonctions système. +|          hook/ | Racine des tests pour les hooks. +|             test-hook-command.cpp | Tests : hooks "command". +|       gui/ | Racine des tests unitaires pour les interfaces. +|          test-gui-bar-window.cpp | Tests : fonctions de fenêtres de barre. +|          test-gui-buffer.cpp | Tests : fonctions de tampons. +|          test-gui-chat.cpp | Tests : fonctions de discussion. +|          test-gui-color.cpp | Tests : couleurs. +|          test-gui-filter.cpp | Tests : filtres. +|          test-gui-input.cpp | Tests : fonctions d'entrée. +|          test-gui-key.cpp | Tests : touches. +|          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-batch.cpp | Tests : évènements batch IRC. +|             test-irc-buffer.cpp | Tests : tampons IRC. +|             test-irc-channel.cpp | Tests : canaux IRC. +|             test-irc-color.cpp | Tests : couleurs IRC. +|             test-irc-config.cpp | Tests : configuration IRC. +|             test-irc-ctcp.cpp | Tests : CTCP IRC. +|             test-irc-ignore.cpp | Tests : ignores IRC. +|             test-irc-info.cpp | Tests : infos IRC. +|             test-irc-join.cpp | Tests : fonctions de join IRC. +|             test-irc-list.cpp | Tests : tampon IRC pour la réponse à la commande /list. +|             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-sasl.cpp | Tests : authentification SASL avec le protocole IRC. +|             test-irc-server.cpp | Tests : serveur IRC. +|             test-irc-tag.cpp | Tests : étiquettes des messages IRC. +|          logger/ | Racine des tests unitaires pour l'extension logger. +|             test-logger.cpp | Tests : logger. +|             test-logger-backlog.cpp | Tests : backlog logger. +|             test-logger-tail.cpp | Tests : fonctions "tail". +|          trigger/ | Racine des tests unitaires pour l'extension trigger. +|             test-trigger.cpp | Tests : triggers. +|             test-trigger-config.cpp | Tests : configuration trigger. +|          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. +|             test-relay-http.cpp | Tests : fonctions HTTP pour l'extension Relay. +|             test-relay-websocket.cpp | Tests : fonctions websocket pour l'extension Relay. +|             api/ | Racine des tests unitaires pour le protocole relay "api". +|                test-relay-api.cpp | Tests : protocole relay "api" : fonctions générales. +|                test-relay-api-msg.cpp | Tests : protocole relay "api" : messages. +|                test-relay-api-protocol.cpp | Tests : protocole relay "api" : protocole. +|             irc/ | Racine des tests unitaires pour le protocole relay "irc". +|                test-relay-irc.cpp | Tests : protocole relay "irc". +|          xfer/ | Racine des tests unitaires pour l'extension Xfer. +|             test-xfer-file.cpp | Tests : fonctions sur les fichiers. +|             test-xfer-network.cpp | Tests : fonctions réseau. |=== [[documentation_translations]] diff --git a/doc/ja/weechat_dev.ja.adoc b/doc/ja/weechat_dev.ja.adoc index 3c7da75b8..189e0bed6 100644 --- a/doc/ja/weechat_dev.ja.adoc +++ b/doc/ja/weechat_dev.ja.adoc @@ -428,145 +428,153 @@ WeeChat "core" は以下のディレクトリに配置されています: [width="100%",cols="2m,3",options="header"] |=== -| パス/ファイル名 | 説明 -| tests/ | テスト用のルートディレクトリ -|    tests.cpp | 全テストの実行時に使われるプログラム +| パス/ファイル名 | 説明 +| tests/ | テスト用のルートディレクトリ +|    tests.cpp | 全テストの実行時に使われるプログラム // TRANSLATION MISSING -|    tests-record.cpp | Record and search in messages displayed. -|    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 | テスト: プラグイン +|    tests-record.cpp | Record and search in messages displayed. +|    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 | テスト: プラグイン // TRANSLATION MISSING -|       test-plugin-api-info.cpp | Tests: plugin API info functions. +|       test-plugin-api-info.cpp | Tests: plugin API info functions. // TRANSLATION MISSING -|       test-plugin-config.cpp | Tests: plugin config functions. -|       core/ | core 向け単体テスト用のルートディレクトリ -|          test-core-arraylist.cpp | テスト: 配列リスト +|       test-plugin-config.cpp | Tests: plugin config functions. +|       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-command.cpp | Tests: commands. +|          test-core-command.cpp | Tests: commands. // TRANSLATION MISSING -|          test-core-config-file.cpp | Tests: configuration files. +|          test-core-config-file.cpp | Tests: configuration files. // 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 | テスト: ユーティリティ関数 +|          test-core-signal.cpp | テスト: signals. +|          test-core-string.cpp | テスト: 文字列 +|          test-core-url.cpp | テスト: URL +|          test-core-utf8.cpp | テスト: UTF-8 +|          test-core-util.cpp | テスト: ユーティリティ関数 // TRANSLATION MISSING -|          test-core-sys.cpp | Tests: system functions. +|          test-core-sys.cpp | Tests: system functions. // TRANSLATION MISSING -|          hook/ | Root of unit tests for hooks. +|          hook/ | Root of unit tests for hooks. // TRANSLATION MISSING -|             test-hook-command.cpp | Tests: hooks "command". -|       gui/ | インターフェースの単体テストを収める最上位ディレクトリ +|             test-hook-command.cpp | Tests: hooks "command". +|       gui/ | インターフェースの単体テストを収める最上位ディレクトリ // TRANSLATION MISSING -|          test-gui-bar-window.cpp | Tests: bar window functions. +|          test-gui-bar-window.cpp | Tests: bar window functions. // TRANSLATION MISSING -|          test-gui-buffer.cpp | Tests: buffer functions. +|          test-gui-buffer.cpp | Tests: buffer functions. // TRANSLATION MISSING -|          test-gui-chat.cpp | Tests: chat functions. +|          test-gui-chat.cpp | Tests: chat functions. // TRANSLATION MISSING -|          test-gui-color.cpp | Tests: colors. +|          test-gui-color.cpp | Tests: colors. // TRANSLATION MISSING -|          test-gui-filter.cpp | Tests: filters. +|          test-gui-filter.cpp | Tests: filters. // TRANSLATION MISSING -|          test-gui-input.cpp | Tests: input functions. +|          test-gui-input.cpp | Tests: input functions. // TRANSLATION MISSING -|          test-gui-key.cpp | Tests: keys. -|          test-gui-line.cpp | テスト: 行 +|          test-gui-key.cpp | Tests: keys. +|          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-batch.cpp | Tests: IRC batched events. +|             test-irc-batch.cpp | Tests: IRC batched events. // TRANSLATION MISSING -|             test-irc-buffer.cpp | Tests: IRC buffers. +|             test-irc-buffer.cpp | Tests: IRC buffers. // 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-ctcp.cpp | Tests: IRC CTCP. +|             test-irc-ctcp.cpp | Tests: IRC CTCP. // TRANSLATION MISSING -|             test-irc-ignore.cpp | Tests: IRC ignores. +|             test-irc-ignore.cpp | Tests: IRC ignores. // TRANSLATION MISSING -|             test-irc-info.cpp | Tests: IRC info. +|             test-irc-info.cpp | Tests: IRC info. // TRANSLATION MISSING -|             test-irc-join.cpp | Tests: IRC join functions. +|             test-irc-join.cpp | Tests: IRC join functions. // TRANSLATION MISSING -|             test-irc-list.cpp | Tests: IRC buffer for reply to /list command. +|             test-irc-list.cpp | Tests: IRC buffer for reply to /list command. // 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-sasl.cpp | Tests: SASL authentication with IRC protocol. +|             test-irc-sasl.cpp | Tests: SASL authentication with IRC protocol. // TRANSLATION MISSING -|             test-irc-server.cpp | Tests: IRC server. +|             test-irc-server.cpp | Tests: IRC server. // TRANSLATION MISSING -|             test-irc-tag.cpp | Tests: IRC message tags. +|             test-irc-tag.cpp | Tests: IRC message tags. // TRANSLATION MISSING -|          logger/ | Root of unit tests for logger plugin. +|          logger/ | Root of unit tests for logger plugin. // TRANSLATION MISSING -|             test-logger.cpp | Tests: logger. +|             test-logger.cpp | Tests: logger. // TRANSLATION MISSING -|             test-logger-backlog.cpp | Tests: logger backlog. +|             test-logger-backlog.cpp | Tests: logger backlog. // TRANSLATION MISSING -|             test-logger-tail.cpp | Tests: logger tail functions. +|             test-logger-tail.cpp | Tests: logger tail functions. // 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 -|             test-trigger-config.cpp | Tests: trigger configuration. +|             test-trigger-config.cpp | Tests: trigger configuration. // TRANSLATION MISSING -|          typing/ | Root of unit tests for typing plugin. +|          typing/ | Root of unit tests for typing plugin. // TRANSLATION MISSING -|             test-typing.cpp | Tests: typing. +|             test-typing.cpp | Tests: typing. // TRANSLATION MISSING -|             test-typing-status.cpp | Tests: typing status. +|             test-typing-status.cpp | Tests: typing status. // TRANSLATION MISSING -|          relay/ | Root of unit tests for Relay plugin. +|          relay/ | Root of unit tests for Relay plugin. // TRANSLATION MISSING -|             test-relay-auth.cpp | Tests: clients authentication. +|             test-relay-auth.cpp | Tests: clients authentication. // TRANSLATION MISSING -|             test-relay-http.cpp | Tests: HTTP functions for Relay plugin. +|             test-relay-http.cpp | Tests: HTTP functions for Relay plugin. // TRANSLATION MISSING -|             test-relay-websocket.cpp | Tests: websocket functions for Relay plugin. +|             test-relay-websocket.cpp | Tests: websocket functions for Relay plugin. // TRANSLATION MISSING -|             irc/ | Root of unit tests for Relay "irc" protocol. +|             api/ | Root of unit tests for Relay "api" protocol. // TRANSLATION MISSING -|                test-relay-irc.cpp | Tests: Relay "irc" protocol. +|                test-relay-api.cpp | Tests: Relay "api" protocol: general functions. // TRANSLATION MISSING -|          xfer/ | Root of unit tests for Xfer plugin. +|                test-relay-api-msg.cpp | Tests: Relay "api" protocol: messages. // TRANSLATION MISSING -|             test-xfer-file.cpp | Tests: file functions. +|                test-relay-api-protocol.cpp | Tests: Relay "api" protocol: protocol. // TRANSLATION MISSING -|             test-xfer-network.cpp | Tests: network functions. +|             irc/ | Root of unit tests for Relay "irc" protocol. +// TRANSLATION MISSING +|                test-relay-irc.cpp | Tests: Relay "irc" protocol. +// TRANSLATION MISSING +|          xfer/ | Root of unit tests for Xfer plugin. +// TRANSLATION MISSING +|             test-xfer-file.cpp | Tests: file functions. +// TRANSLATION MISSING +|             test-xfer-network.cpp | Tests: network functions. |=== [[documentation_translations]] diff --git a/doc/sr/weechat_dev.sr.adoc b/doc/sr/weechat_dev.sr.adoc index 7473624d2..5ad083c99 100644 --- a/doc/sr/weechat_dev.sr.adoc +++ b/doc/sr/weechat_dev.sr.adoc @@ -404,93 +404,97 @@ WeeChat „језгро” се налази у следећим директо [width="100%", cols="2m,3", options="header"] |=== -| Путања/фајл | Опис -| tests/ | Корен тестова. -|    tests.cpp | Програм који се користи за извршавање свих тестова. -|    tests-record.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. -|       test-plugin-api-info.cpp | Тестови: инфо функције API додатака. -|       test-plugin-config.cpp | Тестови: функције конфигурације додатка. -|       core/ | Корен unit тестова језгра. -|          test-core-arraylist.cpp | Тестови: arraylists. -|          test-core-calc.cpp | Тестови: калкулација израза. -|          test-core-command.cpp | Тестови: команде. -|          test-core-config-file.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 | Тестови: помоћне функције. -|          test-core-sys.cpp | Тестови: системске функције. -|          hook/ | Корен unit тестова за куке. -|             test-hook-command.cpp | Тестови: куке „command”. -|       gui/ | Корен unit тестова интерфејса. -|          test-gui-bar-window.cpp | Тестови: функције прозора траке. -|          test-gui-buffer.cpp | Тестови: бафер функције. -|          test-gui-chat.cpp | Тестови: чет функције. -|          test-gui-color.cpp | Тестови: боје. -|          test-gui-filter.cpp | Тестови: филтери. -|          test-gui-input.cpp | Тестови: улазне функкције. -|          test-gui-key.cpp | Тестови: тастери. -|          test-gui-line.cpp | Тестови: линије. -|          test-gui-nick.cpp | Тестови: надимци. -|       plugins/ | Корен unit тестова додатака. -|          irc/ | Корен unit тестова IRC додатка. -|             test-irc-batch.cpp | Тестови: IRC пакетни догађаји. -|             test-irc-buffer.cpp | Тестови: IRC бафери. -|             test-irc-channel.cpp | Тестови: IRC канали. -|             test-irc-color.cpp | Тестови: IRC боје. -|             test-irc-config.cpp | Тестови: IRC конфигурација. -|             test-irc-ctcp.cpp | Тестови: IRC CTCP. -|             test-irc-ignore.cpp | Тестови: IRC игнорисања. -|             test-irc-info.cpp | Тестови: IRC информације. -|             test-irc-join.cpp | Тестови: IRC функције приступања. -|             test-irc-list.cpp | Тестови: IRC бафер за одговор на /list команду. -|             test-irc-message.cpp | Тестови: IRC поруке. -|             test-irc-mode.cpp | Тестови: IRC режими. -|             test-irc-nick.cpp | Тестови: IRC надимци. -|             test-irc-protocol.cpp | Тестови: IRC протокол. -|             test-irc-sasl.cpp | Тестови: SASL аутентификација са IRC протоколом. -|             test-irc-server.cpp | Тестови: IRC сервер. -|             test-irc-tag.cpp | Тестови: IRC ознаке порука. -|          logger/ | Корен unit тестива за logger додатак. -|             test-logger.cpp | Тестови: logger. -|             test-logger-backlog.cpp | Тестови: logger заостатак. -|             test-logger-tail.cpp | Тестови: logger tail фунцкије. -|          trigger/ | Корен unit тестова за окидач додатак. -|             test-trigger.cpp | Тестови: окидачи. -|             test-trigger-config.cpp | Тестови: конфигурација окидача. -|          typing/ | Корен unit тестова за typing додатак. -|             test-typing.cpp | Тестови: typing. -|             test-typing-status.cpp | Тестови: typing статус. -|          relay/ | Корен unit тестова за Релеј додатак. -|             test-relay-auth.cpp | Тестови: аутентификација клијената. +| Путања/фајл | Опис +| tests/ | Корен тестова. +|    tests.cpp | Програм који се користи за извршавање свих тестова. +|    tests-record.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. +|       test-plugin-api-info.cpp | Тестови: инфо функције API додатака. +|       test-plugin-config.cpp | Тестови: функције конфигурације додатка. +|       core/ | Корен unit тестова језгра. +|          test-core-arraylist.cpp | Тестови: arraylists. +|          test-core-calc.cpp | Тестови: калкулација израза. +|          test-core-command.cpp | Тестови: команде. +|          test-core-config-file.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 | Тестови: помоћне функције. +|          test-core-sys.cpp | Тестови: системске функције. +|          hook/ | Корен unit тестова за куке. +|             test-hook-command.cpp | Тестови: куке „command”. +|       gui/ | Корен unit тестова интерфејса. +|          test-gui-bar-window.cpp | Тестови: функције прозора траке. +|          test-gui-buffer.cpp | Тестови: бафер функције. +|          test-gui-chat.cpp | Тестови: чет функције. +|          test-gui-color.cpp | Тестови: боје. +|          test-gui-filter.cpp | Тестови: филтери. +|          test-gui-input.cpp | Тестови: улазне функкције. +|          test-gui-key.cpp | Тестови: тастери. +|          test-gui-line.cpp | Тестови: линије. +|          test-gui-nick.cpp | Тестови: надимци. +|       plugins/ | Корен unit тестова додатака. +|          irc/ | Корен unit тестова IRC додатка. +|             test-irc-batch.cpp | Тестови: IRC пакетни догађаји. +|             test-irc-buffer.cpp | Тестови: IRC бафери. +|             test-irc-channel.cpp | Тестови: IRC канали. +|             test-irc-color.cpp | Тестови: IRC боје. +|             test-irc-config.cpp | Тестови: IRC конфигурација. +|             test-irc-ctcp.cpp | Тестови: IRC CTCP. +|             test-irc-ignore.cpp | Тестови: IRC игнорисања. +|             test-irc-info.cpp | Тестови: IRC информације. +|             test-irc-join.cpp | Тестови: IRC функције приступања. +|             test-irc-list.cpp | Тестови: IRC бафер за одговор на /list команду. +|             test-irc-message.cpp | Тестови: IRC поруке. +|             test-irc-mode.cpp | Тестови: IRC режими. +|             test-irc-nick.cpp | Тестови: IRC надимци. +|             test-irc-protocol.cpp | Тестови: IRC протокол. +|             test-irc-sasl.cpp | Тестови: SASL аутентификација са IRC протоколом. +|             test-irc-server.cpp | Тестови: IRC сервер. +|             test-irc-tag.cpp | Тестови: IRC ознаке порука. +|          logger/ | Корен unit тестива за logger додатак. +|             test-logger.cpp | Тестови: logger. +|             test-logger-backlog.cpp | Тестови: logger заостатак. +|             test-logger-tail.cpp | Тестови: logger tail фунцкије. +|          trigger/ | Корен unit тестова за окидач додатак. +|             test-trigger.cpp | Тестови: окидачи. +|             test-trigger-config.cpp | Тестови: конфигурација окидача. +|          typing/ | Корен unit тестова за typing додатак. +|             test-typing.cpp | Тестови: typing. +|             test-typing-status.cpp | Тестови: typing статус. +|          relay/ | Корен unit тестова за Релеј додатак. +|             test-relay-auth.cpp | Тестови: аутентификација клијената. // TRANSLATION MISSING -|             test-relay-http.cpp | Tests: HTTP functions for Relay plugin. +|             test-relay-http.cpp | Tests: HTTP functions for Relay plugin. // TRANSLATION MISSING -|             test-relay-websocket.cpp | Tests: websocket functions for Relay plugin. -|             irc/ | Корен unit тестова за Релеј „irc” протокол. -|                test-relay-irc.cpp | Тестови: РЕлеј „irc” протокол. -|          xfer/ | Корен unit тестова за Xfer додатак. -|             test-xfer-file.cpp | Тестови: фајл функције. -|             test-xfer-network.cpp | Тестови: мрежне функције. +|             test-relay-websocket.cpp | Tests: websocket functions for Relay plugin. +|             api/ | Root of unit tests for Relay "api" protocol. +|                test-relay-api.cpp | Tests: Relay "api" protocol: general functions. +|                test-relay-api-msg.cpp | Tests: Relay "api" protocol: messages. +|                test-relay-api-protocol.cpp | Tests: Relay "api" protocol: protocol. +|             irc/ | Корен unit тестова за Релеј „irc” протокол. +|                test-relay-irc.cpp | Тестови: РЕлеј „irc” протокол. +|          xfer/ | Корен unit тестова за Xfer додатак. +|             test-xfer-file.cpp | Тестови: фајл функције. +|             test-xfer-network.cpp | Тестови: мрежне функције. |=== [[documentation_translations]] diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 7a12de527..b9227cd01 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -111,6 +111,13 @@ if (ENABLE_RELAY) unit/plugins/relay/test-relay-websocket.cpp unit/plugins/relay/irc/test-relay-irc.cpp ) + if (ENABLE_CJSON) + list(APPEND LIB_WEECHAT_UNIT_TESTS_PLUGINS_SRC + unit/plugins/relay/api/test-relay-api.cpp + unit/plugins/relay/api/test-relay-api-msg.cpp + unit/plugins/relay/api/test-relay-api-protocol.cpp + ) + endif() endif() if(ENABLE_TRIGGER) diff --git a/tests/unit/plugins/relay/api/test-relay-api-msg.cpp b/tests/unit/plugins/relay/api/test-relay-api-msg.cpp new file mode 100644 index 000000000..546713ac1 --- /dev/null +++ b/tests/unit/plugins/relay/api/test-relay-api-msg.cpp @@ -0,0 +1,369 @@ +/* + * test-relay-api-msg.cpp - test relay API protocol (messages) + * + * Copyright (C) 2024 Sébastien Helleu + * + * 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 . + */ + +#include "CppUTest/TestHarness.h" + +extern "C" +{ +#include +#include +#include +#include "src/core/wee-util.h" +#include "src/gui/gui-buffer.h" +#include "src/gui/gui-chat.h" +#include "src/gui/gui-color.h" +#include "src/gui/gui-line.h" +#include "src/gui/gui-nicklist.h" +#include "src/plugins/relay/relay.h" +#include "src/plugins/relay/relay-client.h" +#include "src/plugins/relay/api/relay-api.h" +#include "src/plugins/relay/api/relay-api-msg.h" +} + +#define WEE_CHECK_OBJ_STR(__expected, __json, __name) \ + json_obj = cJSON_GetObjectItem (__json, __name); \ + CHECK(json_obj); \ + CHECK(cJSON_IsString (json_obj)); \ + STRCMP_EQUAL(__expected, cJSON_GetStringValue (json_obj)); + +#define WEE_CHECK_OBJ_STRN(__expected, __length, __json, __name) \ + json_obj = cJSON_GetObjectItem (__json, __name); \ + CHECK(json_obj); \ + CHECK(cJSON_IsString (json_obj)); \ + STRNCMP_EQUAL(__expected, cJSON_GetStringValue (json_obj), \ + __length); + +#define WEE_CHECK_OBJ_INT(__expected, __json, __name) \ + json_obj = cJSON_GetObjectItem (__json, __name); \ + CHECK(json_obj); \ + CHECK(cJSON_IsNumber (json_obj)); \ + LONGS_EQUAL(__expected, cJSON_GetNumberValue (json_obj)); + +#define WEE_CHECK_OBJ_BOOL(__expected, __json, __name) \ + json_obj = cJSON_GetObjectItem (__json, __name); \ + CHECK(json_obj); \ + CHECK(cJSON_IsBool (json_obj)); \ + LONGS_EQUAL(__expected, cJSON_IsTrue (json_obj) ? 1 : 0); + +TEST_GROUP(RelayApiMsg) +{ +}; + +/* + * Tests functions: + * relay_api_msg_send_json_internal + */ + +TEST(RelayApiMsg, SendJsonInternal) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * relay_api_msg_send_json + */ + +TEST(RelayApiMsg, SendJson) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * relay_api_msg_send_error_json + */ + +TEST(RelayApiMsg, SendErrorJson) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * relay_api_msg_send_event + */ + +TEST(RelayApiMsg, SendEvent) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * relay_api_msg_buffer_add_local_vars_cb + * relay_api_msg_buffer_to_json + * relay_api_msg_nick_to_json + * relay_api_msg_nick_group_to_json + */ + +TEST(RelayApiMsg, BufferToJson) +{ + cJSON *json, *json_obj, *json_local_vars, *json_lines; + cJSON *json_nicks, *json_groups, *json_group, *json_group_nicks, *json_nick; + struct t_gui_buffer *buffer; + struct t_gui_nick_group *group; + + json = relay_api_msg_buffer_to_json (NULL, 0, 0, RELAY_API_COLORS_ANSI); + CHECK(json); + CHECK(cJSON_IsObject (json)); + POINTERS_EQUAL(NULL, cJSON_GetObjectItem (json, "name")); + cJSON_Delete (json); + + /* buffer without lines and nicks */ + json = relay_api_msg_buffer_to_json (gui_buffers, 0, 0, RELAY_API_COLORS_ANSI); + CHECK(json); + CHECK(cJSON_IsObject (json)); + WEE_CHECK_OBJ_STR("core.weechat", json, "name"); + WEE_CHECK_OBJ_STR("weechat", json, "short_name"); + WEE_CHECK_OBJ_INT(1, json, "number"); + WEE_CHECK_OBJ_STR("formatted", json, "type"); + WEE_CHECK_OBJ_STRN("WeeChat", 7, json, "title"); + json_local_vars = cJSON_GetObjectItem (json, "local_variables"); + CHECK(json_local_vars); + CHECK(cJSON_IsObject (json_local_vars)); + WEE_CHECK_OBJ_STR("core", json_local_vars, "plugin"); + WEE_CHECK_OBJ_STR("weechat", json_local_vars, "name"); + POINTERS_EQUAL(NULL, cJSON_GetObjectItem (json, "lines")); + POINTERS_EQUAL(NULL, cJSON_GetObjectItem (json, "nicks")); + cJSON_Delete (json); + + /* buffer with 2 lines, without nicks */ + json = relay_api_msg_buffer_to_json (gui_buffers, 2, 0, RELAY_API_COLORS_ANSI); + CHECK(json); + CHECK(cJSON_IsObject (json)); + json_lines = cJSON_GetObjectItem (json, "lines"); + CHECK(json_lines); + CHECK(cJSON_IsArray (json_lines)); + LONGS_EQUAL(2, cJSON_GetArraySize (json_lines)); + cJSON_Delete (json); + + /* create a user buffer with 1 group / 4 nicks */ + buffer = gui_buffer_new_user ("test", GUI_BUFFER_TYPE_FORMATTED); + CHECK(buffer); + group = gui_nicklist_add_group (buffer, NULL, "group1", "magenta", 1); + CHECK(group); + CHECK(gui_nicklist_add_nick (buffer, group, "nick1", "blue", "@", "lightred", 1)); + CHECK(gui_nicklist_add_nick (buffer, group, "nick2", "green", NULL, NULL, 1)); + CHECK(gui_nicklist_add_nick (buffer, group, "nick3", "yellow", NULL, NULL, 1)); + CHECK(gui_nicklist_add_nick (buffer, NULL, "root_nick_hidden", "cyan", "+", "yellow", 0)); + + /* buffer with no lines and 1 group / 4 nicks */ + json = relay_api_msg_buffer_to_json (buffer, 1, 1, RELAY_API_COLORS_ANSI); + CHECK(json); + CHECK(cJSON_IsObject (json)); + json_lines = cJSON_GetObjectItem (json, "lines"); + CHECK(json_lines); + CHECK(cJSON_IsArray (json_lines)); + LONGS_EQUAL(0, cJSON_GetArraySize (json_lines)); + json_nicks = cJSON_GetObjectItem (json, "nicks"); + CHECK(json_nicks); + CHECK(cJSON_IsObject (json_nicks)); + WEE_CHECK_OBJ_STR("root", json_nicks, "name"); + WEE_CHECK_OBJ_STR("", json_nicks, "color"); + json_groups = cJSON_GetObjectItem (json_nicks, "groups"); + CHECK(json_groups); + CHECK(cJSON_IsArray (json_groups)); + LONGS_EQUAL(1, cJSON_GetArraySize (json_groups)); + json_group = cJSON_GetArrayItem (json_groups, 0); + CHECK(json_group); + CHECK(cJSON_IsObject (json_group)); + WEE_CHECK_OBJ_STR("group1", json_group, "name"); + WEE_CHECK_OBJ_STR("magenta", json_group, "color"); + json_group_nicks = cJSON_GetObjectItem (json_group, "nicks"); + CHECK(json_group_nicks); + CHECK(cJSON_IsArray (json_group_nicks)); + LONGS_EQUAL(3, cJSON_GetArraySize (json_group_nicks)); + json_nick = cJSON_GetArrayItem (json_group_nicks, 0); + CHECK(json_nick); + CHECK(cJSON_IsObject (json_nick)); + WEE_CHECK_OBJ_STR("@", json_nick, "prefix"); + WEE_CHECK_OBJ_STR("lightred", json_nick, "prefix_color"); + WEE_CHECK_OBJ_STR("nick1", json_nick, "name"); + WEE_CHECK_OBJ_STR("blue", json_nick, "color"); + WEE_CHECK_OBJ_BOOL(1, json_nick, "visible"); + json_nick = cJSON_GetArrayItem (json_group_nicks, 1); + CHECK(json_nick); + CHECK(cJSON_IsObject (json_nick)); + WEE_CHECK_OBJ_STR("", json_nick, "prefix"); + WEE_CHECK_OBJ_STR("", json_nick, "prefix_color"); + WEE_CHECK_OBJ_STR("nick2", json_nick, "name"); + WEE_CHECK_OBJ_STR("green", json_nick, "color"); + WEE_CHECK_OBJ_BOOL(1, json_nick, "visible"); + json_nick = cJSON_GetArrayItem (json_group_nicks, 2); + CHECK(json_nick); + CHECK(cJSON_IsObject (json_nick)); + WEE_CHECK_OBJ_STR("", json_nick, "prefix"); + WEE_CHECK_OBJ_STR("", json_nick, "prefix_color"); + WEE_CHECK_OBJ_STR("nick3", json_nick, "name"); + WEE_CHECK_OBJ_STR("yellow", json_nick, "color"); + WEE_CHECK_OBJ_BOOL(1, json_nick, "visible"); + json_nicks = cJSON_GetObjectItem (json_nicks, "nicks"); + CHECK(json_nicks); + CHECK(cJSON_IsArray (json_nicks)); + LONGS_EQUAL(1, cJSON_GetArraySize (json_nicks)); + json_nick = cJSON_GetArrayItem (json_nicks, 0); + CHECK(json_nick); + CHECK(cJSON_IsObject (json_nick)); + WEE_CHECK_OBJ_STR("+", json_nick, "prefix"); + WEE_CHECK_OBJ_STR("yellow", json_nick, "prefix_color"); + WEE_CHECK_OBJ_STR("root_nick_hidden", json_nick, "name"); + WEE_CHECK_OBJ_STR("cyan", json_nick, "color"); + WEE_CHECK_OBJ_BOOL(0, json_nick, "visible"); + cJSON_Delete (json); + + gui_buffer_close (buffer); +} + +/* + * Tests functions: + * relay_api_msg_line_data_to_json + * relay_api_msg_lines_to_json + */ + +TEST(RelayApiMsg, LinesToJson) +{ + char str_msg1[1024], str_msg2[1024], *str_msg_ansi, str_date[128]; + cJSON *json, *json_line, *json_obj, *json_tags, *json_tag; + struct timeval tv; + struct tm gm_time; + + snprintf (str_msg1, sizeof (str_msg1), "%s", "this is the first line"); + gui_chat_printf_date_tags (NULL, 0, "tag1,tag2,tag3", + "%s\t%s", "nick1", str_msg1); + + snprintf (str_msg2, sizeof (str_msg2), + "this is the second line with %s" "green", + gui_color_get_custom ("green")); + gui_chat_printf (NULL, "%s", str_msg2); + + /* two lines with ANSI colors */ + json = relay_api_msg_lines_to_json (gui_buffers, -2, RELAY_API_COLORS_ANSI); + CHECK(json); + CHECK(cJSON_IsArray (json)); + LONGS_EQUAL(2, cJSON_GetArraySize (json)); + /* first line */ + json_line = cJSON_GetArrayItem (json, 0); + CHECK(json_line); + CHECK(cJSON_IsObject (json_line)); + WEE_CHECK_OBJ_INT(gui_buffers->own_lines->last_line->prev_line->data->id, + json_line, "id"); + WEE_CHECK_OBJ_INT(-1, json_line, "y"); + gmtime_r (&(gui_buffers->own_lines->last_line->prev_line->data->date), &gm_time); + tv.tv_sec = mktime (&gm_time); + tv.tv_usec = gui_buffers->own_lines->last_line->prev_line->data->date_usec; + util_strftimeval (str_date, sizeof (str_date), "%FT%T.%fZ", &tv); + WEE_CHECK_OBJ_STR(str_date, json_line, "date"); + gmtime_r (&(gui_buffers->own_lines->last_line->prev_line->data->date_printed), &gm_time); + tv.tv_sec = mktime (&gm_time); + tv.tv_usec = gui_buffers->own_lines->last_line->prev_line->data->date_usec_printed; + util_strftimeval (str_date, sizeof (str_date), "%FT%T.%fZ", &tv); + WEE_CHECK_OBJ_STR(str_date, json_line, "date_printed"); + WEE_CHECK_OBJ_BOOL(0, json_line, "highlight"); + WEE_CHECK_OBJ_STR("nick1", json_line, "prefix"); + WEE_CHECK_OBJ_STR(str_msg1, json_line, "message"); + json_tags = cJSON_GetObjectItem (json_line, "tags"); + CHECK(json_tags); + CHECK(cJSON_IsArray (json_tags)); + LONGS_EQUAL(3, cJSON_GetArraySize (json_tags)); + json_tag = cJSON_GetArrayItem (json_tags, 0); + CHECK(json_tag); + CHECK(cJSON_IsString (json_tag)); + STRCMP_EQUAL("tag1", cJSON_GetStringValue (json_tag)); + json_tag = cJSON_GetArrayItem (json_tags, 1); + CHECK(json_tag); + CHECK(cJSON_IsString (json_tag)); + STRCMP_EQUAL("tag2", cJSON_GetStringValue (json_tag)); + json_tag = cJSON_GetArrayItem (json_tags, 2); + CHECK(json_tag); + CHECK(cJSON_IsString (json_tag)); + STRCMP_EQUAL("tag3", cJSON_GetStringValue (json_tag)); + /* second line */ + json_line = cJSON_GetArrayItem (json, 1); + CHECK(json_line); + CHECK(cJSON_IsObject (json_line)); + WEE_CHECK_OBJ_INT(gui_buffers->own_lines->last_line->data->id, + json_line, "id"); + WEE_CHECK_OBJ_INT(-1, json_line, "y"); + gmtime_r (&(gui_buffers->own_lines->last_line->data->date), &gm_time); + tv.tv_sec = mktime (&gm_time); + tv.tv_usec = gui_buffers->own_lines->last_line->data->date_usec; + util_strftimeval (str_date, sizeof (str_date), "%FT%T.%fZ", &tv); + WEE_CHECK_OBJ_STR(str_date, json_line, "date"); + gmtime_r (&(gui_buffers->own_lines->last_line->data->date_printed), &gm_time); + tv.tv_sec = mktime (&gm_time); + tv.tv_usec = gui_buffers->own_lines->last_line->data->date_usec_printed; + util_strftimeval (str_date, sizeof (str_date), "%FT%T.%fZ", &tv); + WEE_CHECK_OBJ_STR(str_date, json_line, "date_printed"); + WEE_CHECK_OBJ_BOOL(0, json_line, "highlight"); + WEE_CHECK_OBJ_STR("", json_line, "prefix"); + str_msg_ansi = gui_color_encode_ansi (str_msg2); + CHECK(str_msg_ansi); + WEE_CHECK_OBJ_STR(str_msg_ansi, json_line, "message"); + free (str_msg_ansi); + json_tags = cJSON_GetObjectItem (json_line, "tags"); + CHECK(json_tags); + CHECK(cJSON_IsArray (json_tags)); + LONGS_EQUAL(0, cJSON_GetArraySize (json_tags)); + cJSON_Delete (json); + + /* with ANSI colors */ + json = relay_api_msg_lines_to_json (gui_buffers, -1, RELAY_API_COLORS_ANSI); + CHECK(json); + CHECK(cJSON_IsArray (json)); + LONGS_EQUAL(1, cJSON_GetArraySize (json)); + json_line = cJSON_GetArrayItem (json, 0); + CHECK(json_line); + CHECK(cJSON_IsObject (json_line)); + WEE_CHECK_OBJ_INT(gui_buffers->own_lines->last_line->data->id, + json_line, "id"); + str_msg_ansi = gui_color_encode_ansi (str_msg2); + CHECK(str_msg_ansi); + WEE_CHECK_OBJ_STR(str_msg_ansi, json_line, "message"); + free (str_msg_ansi); + cJSON_Delete (json); + + /* one line with WeeChat colors */ + json = relay_api_msg_lines_to_json (gui_buffers, -1, RELAY_API_COLORS_WEECHAT); + CHECK(json); + CHECK(cJSON_IsArray (json)); + LONGS_EQUAL(1, cJSON_GetArraySize (json)); + json_line = cJSON_GetArrayItem (json, 0); + CHECK(json_line); + CHECK(cJSON_IsObject (json_line)); + WEE_CHECK_OBJ_INT(gui_buffers->own_lines->last_line->data->id, + json_line, "id"); + WEE_CHECK_OBJ_STR(str_msg2, json_line, "message"); + cJSON_Delete (json); + + /* one line without colors */ + json = relay_api_msg_lines_to_json (gui_buffers, -1, RELAY_API_COLORS_STRIP); + CHECK(json); + CHECK(cJSON_IsArray (json)); + LONGS_EQUAL(1, cJSON_GetArraySize (json)); + json_line = cJSON_GetArrayItem (json, 0); + CHECK(json_line); + CHECK(cJSON_IsObject (json_line)); + WEE_CHECK_OBJ_INT(gui_buffers->own_lines->last_line->data->id, + json_line, "id"); + WEE_CHECK_OBJ_STR("this is the second line with green", json_line, "message"); + cJSON_Delete (json); +} diff --git a/tests/unit/plugins/relay/api/test-relay-api-protocol.cpp b/tests/unit/plugins/relay/api/test-relay-api-protocol.cpp new file mode 100644 index 000000000..9cd826713 --- /dev/null +++ b/tests/unit/plugins/relay/api/test-relay-api-protocol.cpp @@ -0,0 +1,142 @@ +/* + * test-relay-api-protocol.cpp - test relay API protocol (protocol) + * + * Copyright (C) 2024 Sébastien Helleu + * + * 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 . + */ + +#include "CppUTest/TestHarness.h" + +extern "C" +{ +#include "src/plugins/relay/relay.h" +#include "src/plugins/relay/api/relay-api-protocol.h" +} + +TEST_GROUP(RelayApiProtocol) +{ +}; + +/* + * Tests functions: + * relay_api_protocol_signal_buffer_cb + */ + +TEST(RelayApiProtocol, SignalBufferCb) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * relay_api_protocol_hsignal_nicklist_cb + */ + +TEST(RelayApiProtocol, HsignalNicklistCb) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * relay_api_protocol_signal_upgrade_cb + */ + +TEST(RelayApiProtocol, SignalUpgradeCb) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * relay_api_protocol_cb_handshake + */ + +TEST(RelayApiProtocol, CbHandshake) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * relay_api_protocol_cb_version + */ + +TEST(RelayApiProtocol, CbVersion) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * relay_api_protocol_cb_buffers + */ + +TEST(RelayApiProtocol, CbBuffers) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * relay_api_protocol_cb_input + */ + +TEST(RelayApiProtocol, CbInput) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * relay_api_protocol_cb_ping + */ + +TEST(RelayApiProtocol, CbPing) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * relay_api_protocol_cb_sync + */ + +TEST(RelayApiProtocol, CbSync) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * relay_api_protocol_recv_json + */ + +TEST(RelayApiProtocol, RecvJson) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * relay_api_protocol_recv_http + */ + +TEST(RelayApiProtocol, RecvHttp) +{ + /* TODO: write tests */ +} diff --git a/tests/unit/plugins/relay/api/test-relay-api.cpp b/tests/unit/plugins/relay/api/test-relay-api.cpp new file mode 100644 index 000000000..08d1cb4bb --- /dev/null +++ b/tests/unit/plugins/relay/api/test-relay-api.cpp @@ -0,0 +1,160 @@ +/* + * test-relay-api.cpp - test relay API protocol (general functions) + * + * Copyright (C) 2024 Sébastien Helleu + * + * 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 . + */ + +#include "CppUTest/TestHarness.h" + +extern "C" +{ +#include "src/plugins/relay/relay.h" +#include "src/plugins/relay/relay-client.h" +#include "src/plugins/relay/api/relay-api.h" +} + +TEST_GROUP(RelayApi) +{ +}; + +/* + * Tests functions: + * relay_api_search_colors + */ + +TEST(RelayApi, SearchColors) +{ + LONGS_EQUAL(RELAY_API_COLORS_ANSI, relay_api_search_colors (NULL)); + LONGS_EQUAL(RELAY_API_COLORS_ANSI, relay_api_search_colors ("")); + LONGS_EQUAL(RELAY_API_COLORS_ANSI, relay_api_search_colors ("xxx")); + LONGS_EQUAL(RELAY_API_COLORS_ANSI, relay_api_search_colors ("WEECHAT")); + LONGS_EQUAL(RELAY_API_COLORS_ANSI, relay_api_search_colors ("STRIP")); + + LONGS_EQUAL(RELAY_API_COLORS_WEECHAT, relay_api_search_colors ("weechat")); + LONGS_EQUAL(RELAY_API_COLORS_STRIP, relay_api_search_colors ("strip")); +} + +/* + * Tests functions: + * relay_api_hook_signals + */ + +TEST(RelayApi, HookSignals) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * relay_api_unhook_signals + */ + +TEST(RelayApi, UnhookSignals) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * relay_api_recv_http + */ + +TEST(RelayApi, RecvHttp) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * relay_api_recv_json + */ + +TEST(RelayApi, RecvJson) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * relay_api_close_connection + */ + +TEST(RelayApi, CloseConnection) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * relay_api_alloc + */ + +TEST(RelayApi, Alloc) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * relay_api_alloc_with_infolist + */ + +TEST(RelayApi, AllocWithInfolist) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * relay_api_get_initial_status + */ + +TEST(RelayApi, GetInitialStatus) +{ + LONGS_EQUAL(RELAY_STATUS_WAITING_AUTH, relay_api_get_initial_status (NULL)); +} + +/* + * Tests functions: + * relay_api_free + */ + +TEST(RelayApi, Free) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * relay_api_add_to_infolist + */ + +TEST(RelayApi, AddToInfolist) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * relay_api_print_log + */ + +TEST(RelayApi, PrintLog) +{ + /* TODO: write tests */ +} diff --git a/tests/unit/plugins/relay/irc/test-relay-irc.cpp b/tests/unit/plugins/relay/irc/test-relay-irc.cpp index 57c6ee76e..62353ac79 100644 --- a/tests/unit/plugins/relay/irc/test-relay-irc.cpp +++ b/tests/unit/plugins/relay/irc/test-relay-irc.cpp @@ -1,5 +1,5 @@ /* - * test-relay-irc.cpp - test IRC protocol for relay to client + * test-relay-irc.cpp - test relay IRC protocol * * Copyright (C) 2023-2024 Sébastien Helleu *