test(chat): roundtrip every ASCII control byte in channel JSON

This commit is contained in:
evgeny committed 2026-10-27 06:00:15 +01:00
1 parent f5270db52b
commit cb0b71aec1
2 files changed
+5 -2

No files matched your search

+2 -1
View File
@@ -2,7 +2,8 @@
* chat_member.h — единая структура мембера для отображения в GUI
*
* Используется chatgui (desktop), headless CLI, Android.
* Live-снимки для всех потребителей формирует chat_core_get_member_list() в uasync-потоке.
* Бинарные снимки для GUI/JNI формирует chat_core_get_member_list() в uasync-потоке.
* Расширенная JSON-интроспекция с ключами/адресами описана отдельно в chat_core.h.
* Снимок содержит свойства участника и состояние маршрута именно его CHAT-группы.
* Все вызовы — в uasync-потоке. ch_id — канонический десятичный ID1..INT64_MAX.
* В список входят self,placeholders и deleted;deleted показывается offline,self обычно online.
+3 -1
View File
@@ -199,7 +199,9 @@ int main(void) {
struct UTUN_INSTANCE* inst = utun_instance_create_from_str(ua,
"[ntp]\nenabled=no\n[chatserver]\ngroup_autoconnect=0\nstorage_autoload=0\n");
assert(inst && !utun_core_start(inst) && !chat_service_start(inst));
const char name[] = "Канал \x01 \"\\\n";
char name[64] = "Канал "; size_t name_bytes = strlen(name);
for (int c = 1; c < 32; c++) name[name_bytes++] = (char)c;
memcpy(name + name_bytes, " \"\\", 4);
uint64_t id = chat_core_create_channel_auto(inst, name); assert(id); char channel[32];
snprintf(channel, sizeof(channel), "%llu", (unsigned long long)id);
char json[4096]; size_t size = 0; assert(!chat_core_get_channels_json(inst, json, sizeof(json), &size));