From a660ec1afa7dde9372f75d84cf0bc03f6d319c96 Mon Sep 17 00:00:00 2001 From: wingphil Date: Wed, 5 Mar 2025 16:13:20 +0000 Subject: [PATCH] test: fix console unit tests due to changed shell output --- test/test_api/test_api.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/test/test_api/test_api.cpp b/test/test_api/test_api.cpp index 54b6461be..8338af0c1 100644 --- a/test/test_api/test_api.cpp +++ b/test/test_api/test_api.cpp @@ -292,13 +292,16 @@ void run_manual_tests() { const char * run_console_command(const char * command) { output_buffer[0] = '\0'; // empty the temp buffer shell->invoke_command(command); - // remove everything before \r\n + + // The buffer now contains a prompt, the command, the output and a \r\n + // remove the \r\n at the end char * p = strstr(output_buffer, "\r\n"); if (p) { - p += 2; // skip the \r\n + *p = '\0'; } - // remove the \r\n at the end - p[strlen(p) - 2] = '\0'; + + // Now go to just after the prompt and command + p = output_buffer + 7 + strlen(command); // Serial.println("Output:"); // Serial.print(p);