tests update

This commit is contained in:
J. Nick Koston
2026-01-09 16:36:17 -10:00
parent 682b2104f2
commit f01aeded4d
+5 -5
View File
@@ -13,22 +13,22 @@ climate:
on_state:
- logger.log: State changed!
- lambda: |-
// Test get_custom_fan_mode() returns std::string_view
// Test get_custom_fan_mode() returns StringRef
if (id(midea_unit).has_custom_fan_mode()) {
auto fan_mode = id(midea_unit).get_custom_fan_mode();
// Compare with string literal using ==
if (fan_mode == "SILENT") {
ESP_LOGD("test", "Fan mode is SILENT");
}
// Log using %.*s format for string_view
ESP_LOGD("test", "Custom fan mode: %.*s", (int) fan_mode.size(), fan_mode.data());
// Log using %.*s format for StringRef
ESP_LOGD("test", "Custom fan mode: %.*s", (int) fan_mode.size(), fan_mode.c_str());
}
// Test get_custom_preset() returns std::string_view
// Test get_custom_preset() returns StringRef
if (id(midea_unit).has_custom_preset()) {
auto preset = id(midea_unit).get_custom_preset();
// Check if empty
if (!preset.empty()) {
ESP_LOGD("test", "Custom preset: %.*s", (int) preset.size(), preset.data());
ESP_LOGD("test", "Custom preset: %.*s", (int) preset.size(), preset.c_str());
}
}
transmitter_id: xmitr