From ee0d325648929510e37d8edd918b4ca82704bf37 Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Thu, 19 Mar 2026 08:50:58 +0100 Subject: [PATCH] tests: add prof_send_raw Allow sending byte sequences to the Profanity PTY without a newline. Now we can simulate control characters, specifically the `TAB` key (`\t`), to trigger autocompletion. --- tests/functionaltests/proftest.c | 8 ++++++++ tests/functionaltests/proftest.h | 1 + 2 files changed, 9 insertions(+) diff --git a/tests/functionaltests/proftest.c b/tests/functionaltests/proftest.c index d91c2251..62384e4b 100644 --- a/tests/functionaltests/proftest.c +++ b/tests/functionaltests/proftest.c @@ -397,6 +397,14 @@ prof_input(const char* input) usleep(1000 * 100); // 100ms delay } +void +prof_send_raw(const char* bytes) +{ + write(fd, bytes, strlen(bytes)); + tcdrain(fd); + usleep(1000 * 100); +} + int prof_output_exact(const char* text) { diff --git a/tests/functionaltests/proftest.h b/tests/functionaltests/proftest.h index 85b62f7b..a5d2f679 100644 --- a/tests/functionaltests/proftest.h +++ b/tests/functionaltests/proftest.h @@ -28,6 +28,7 @@ void prof_start(void); void prof_connect(void); void prof_connect_with_roster(const char* roster); void prof_input(const char* input); +void prof_send_raw(const char* bytes); int prof_output_exact(const char* text); int prof_output_regex(const char* text);