Skip to content

Commit 131aa4c

Browse files
committed
Fix CLang Tidy error
1 parent ba69e21 commit 131aa4c

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

extras/tests/ResourceManager/StringBuilder.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
#include <catch.hpp>
77

88
#include "Allocators.hpp"
9-
#include "Literals.hpp"
109

10+
using namespace ArduinoJson;
1111
using namespace ArduinoJson::detail;
1212

1313
TEST_CASE("StringBuilder") {
@@ -116,12 +116,12 @@ TEST_CASE("StringBuilder") {
116116
}
117117
}
118118

119-
static const char* saveString(StringBuilder& builder, const char* s) {
119+
static JsonString saveString(StringBuilder& builder, const char* s) {
120120
VariantData data;
121121
builder.startString();
122122
builder.append(s);
123123
builder.save(&data);
124-
return data.asString().c_str();
124+
return data.asString();
125125
}
126126

127127
TEST_CASE("StringBuilder::save() deduplicates strings") {
@@ -134,9 +134,9 @@ TEST_CASE("StringBuilder::save() deduplicates strings") {
134134
auto s2 = saveString(builder, "world");
135135
auto s3 = saveString(builder, "hello");
136136

137-
REQUIRE(s1 == "hello"_s);
138-
REQUIRE(s2 == "world"_s);
139-
REQUIRE(+s1 == +s3); // same address
137+
REQUIRE(s1 == "hello");
138+
REQUIRE(s2 == "world");
139+
REQUIRE(+s1.c_str() == +s3.c_str()); // same address
140140

141141
REQUIRE(spy.log() ==
142142
AllocatorLog{
@@ -152,9 +152,9 @@ TEST_CASE("StringBuilder::save() deduplicates strings") {
152152
auto s1 = saveString(builder, "hello world");
153153
auto s2 = saveString(builder, "hello");
154154

155-
REQUIRE(s1 == "hello world"_s);
156-
REQUIRE(s2 == "hello"_s);
157-
REQUIRE(+s2 != +s1); // different address
155+
REQUIRE(s1 == "hello world");
156+
REQUIRE(s2 == "hello");
157+
REQUIRE(+s2.c_str() != +s1.c_str()); // different address
158158

159159
REQUIRE(spy.log() ==
160160
AllocatorLog{
@@ -169,9 +169,9 @@ TEST_CASE("StringBuilder::save() deduplicates strings") {
169169
auto s1 = saveString(builder, "hello world");
170170
auto s2 = saveString(builder, "worl");
171171

172-
REQUIRE(s1 == "hello world"_s);
173-
REQUIRE(s2 == "worl"_s);
174-
REQUIRE(s2 != s1);
172+
REQUIRE(s1 == "hello world");
173+
REQUIRE(s2 == "worl");
174+
REQUIRE(s2.c_str() != s1.c_str()); // different address
175175

176176
REQUIRE(spy.log() ==
177177
AllocatorLog{

0 commit comments

Comments
 (0)