mirror of
https://github.com/esphome/esphome.git
synced 2026-09-11 15:27:33 +00:00
[core] Convert a null StringRef to an empty JSON string and pin null against null
This commit is contained in:
@@ -94,4 +94,12 @@ TEST(StringRefNullEmpty, ComparesAgainstText) {
|
||||
EXPECT_TRUE(text.starts_with(null_empty));
|
||||
}
|
||||
|
||||
TEST(StringRefNullEmpty, TwoNullViewsAreEqual) {
|
||||
const StringRef a{nullptr, 0};
|
||||
const StringRef b{nullptr, 0};
|
||||
EXPECT_TRUE(a == b);
|
||||
EXPECT_EQ(a.compare(b), 0);
|
||||
EXPECT_TRUE(a.starts_with(b));
|
||||
}
|
||||
|
||||
} // namespace esphome::core::testing
|
||||
|
||||
Reference in New Issue
Block a user