mirror of
https://github.com/esphome/esphome.git
synced 2026-02-16 14:45:24 -07:00
Add unit tests for FlashStringLiteral
Cover the three lines reported uncovered by codecov in cpp_generator.py (FlashStringLiteral.__init__ and __str__).
This commit is contained in:
@@ -248,6 +248,12 @@ class TestLiterals:
|
||||
(cg.FloatLiteral(4.2), "4.2f"),
|
||||
(cg.FloatLiteral(1.23456789), "1.23456789f"),
|
||||
(cg.FloatLiteral(math.nan), "NAN"),
|
||||
(cg.FlashStringLiteral("hello"), 'ESPHOME_F("hello")'),
|
||||
(cg.FlashStringLiteral(""), 'ESPHOME_F("")'),
|
||||
(
|
||||
cg.FlashStringLiteral('quote"here'),
|
||||
'ESPHOME_F("quote\\042here")',
|
||||
),
|
||||
),
|
||||
)
|
||||
def test_str__simple(self, target: cg.Literal, expected: str):
|
||||
|
||||
Reference in New Issue
Block a user