Skip to content

Commit 320258a

Browse files
refactor: address Sonar warnings in label helpers
1 parent e189a4d commit 320258a

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

test/ScopeTimerTest.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class ScopeTimer_TestFriend {
4040
test_labelarg_literal_and_pointer_variants();
4141
test_labeldata_manual_empty_view();
4242
test_labelarg_empty_literal_to_labeldata();
43+
test_labeldata_constructor_default_view();
4344
test_labelarg_owned_to_labeldata();
4445
test_scope_timer_string_view_ctor();
4546
test_looped_work();
@@ -263,6 +264,12 @@ class ScopeTimer_TestFriend {
263264
expect(data.storage.empty(), "LabelArg empty literal does not allocate storage");
264265
}
265266

267+
static void test_labeldata_constructor_default_view() {
268+
::xyzzy::scopetimer::detail::LabelData data(std::string_view{});
269+
expect(data.view == std::string_view("ScopeTimer"), "LabelData ctor defaults empty inputs to ScopeTimer");
270+
expect(data.storage.empty(), "LabelData ctor leaves storage empty when no ownership provided");
271+
}
272+
266273
static void test_labelarg_owned_to_labeldata() {
267274
std::string ownedSource = "tests:label:owned";
268275
::xyzzy::scopetimer::detail::LabelArg arg{std::move(ownedSource)};

0 commit comments

Comments
 (0)