test: fix console unit tests due to changed shell output

This commit is contained in:
wingphil
2025-03-05 16:13:20 +00:00
parent 9f60560f2b
commit b7458b0686
2 changed files with 8 additions and 4 deletions

View File

@@ -28,6 +28,7 @@ For more details go to [docs.emsesp.org](https://docs.emsesp.org/).
- thermostat date [#2313](https://github.com/emsesp/EMS-ESP32/issues/2313)
- Updated unknown compressor stati "enum_hpactivity" [#2311](https://github.com/emsesp/EMS-ESP32/pull/2311)
- Underline Tab headers in WebUI
- console unit tests fixed due to changed shell output
## Changed

View File

@@ -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);