forked from qt-creator/qt-creator
Utils: Add isEmpty to string view
Change-Id: Ib7e77602dcdcdf481f6ab690bacef53c5dd92580 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -85,6 +85,12 @@ public:
|
|||||||
return m_size;
|
return m_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constexpr
|
||||||
|
size_type isEmpty() const
|
||||||
|
{
|
||||||
|
return m_size == 0;
|
||||||
|
}
|
||||||
|
|
||||||
const_iterator begin() const noexcept
|
const_iterator begin() const noexcept
|
||||||
{
|
{
|
||||||
return data();
|
return data();
|
||||||
|
|||||||
@@ -731,6 +731,12 @@ TEST(SmallString, IsEmpty)
|
|||||||
ASSERT_TRUE(SmallString().isEmpty());
|
ASSERT_TRUE(SmallString().isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(SmallString, StringViewIsEmpty)
|
||||||
|
{
|
||||||
|
ASSERT_FALSE(SmallStringView("text").isEmpty());
|
||||||
|
ASSERT_TRUE(SmallStringView("").isEmpty());
|
||||||
|
}
|
||||||
|
|
||||||
TEST(SmallString, HasContent)
|
TEST(SmallString, HasContent)
|
||||||
{
|
{
|
||||||
ASSERT_TRUE(SmallString("text").hasContent());
|
ASSERT_TRUE(SmallString("text").hasContent());
|
||||||
|
|||||||
Reference in New Issue
Block a user