mirror of
https://github.com/esphome/esphome.git
synced 2026-10-06 19:06:37 +00:00
Merge branch 'dev' into configure_entity
This commit is contained in:
@@ -66,5 +66,20 @@ def test_text_config_lamda_is_set(generate_main):
|
||||
main_cpp = generate_main("tests/component_tests/text/test_text.yaml")
|
||||
|
||||
# Then
|
||||
assert "it_4->set_template([]() -> esphome::optional<std::string> {" in main_cpp
|
||||
assert "it_4->set_template([]() -> std::optional<std::string> {" in main_cpp
|
||||
assert 'return std::string{"Hello"};' in main_cpp
|
||||
|
||||
|
||||
def test_esphome_optional_alias_works(generate_main):
|
||||
"""
|
||||
Test that esphome::optional alias compiles (backward compatibility)
|
||||
"""
|
||||
# Given
|
||||
|
||||
# When
|
||||
main_cpp = generate_main("tests/component_tests/text/test_text.yaml")
|
||||
|
||||
# Then
|
||||
# Codegen emits std::optional, but esphome::optional must also work
|
||||
# via the using alias in esphome/core/optional.h
|
||||
assert "std::optional<std::string>" in main_cpp
|
||||
|
||||
Reference in New Issue
Block a user