Skip to content

Commit 1dd46ac

Browse files
authored
UTBot don't decorate struct field [BUG] #465 (#470)
* UTBot don't decorate struct field [BUG] #465
1 parent 80106dd commit 1dd46ac

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

server/src/NameDecorator.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ const std::unordered_set<std::string> NameDecorator::CPP_KEYWORDS = {
7575
"explicit",
7676
"export",
7777
"extern",
78-
"false",
78+
// "false",
7979
"float",
8080
"for",
8181
"friend",
@@ -115,7 +115,7 @@ const std::unordered_set<std::string> NameDecorator::CPP_KEYWORDS = {
115115
"this",
116116
"thread_local",
117117
"throw",
118-
"true",
118+
// "true",
119119
"try",
120120
"typedef",
121121
"typeid",

server/src/Tests.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ namespace tests {
294294
if (structInfo.fields[i].name.empty())
295295
return "";
296296

297-
std::string prefix = "." + structInfo.fields[i].name + " = ";
297+
std::string prefix = "." + NameDecorator::decorate(structInfo.fields[i].name) + " = ";
298298
if (structInfo.isCLike) {
299299
return prefix;
300300
}

server/src/visitors/AssertsVisitor.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ namespace visitor {
3939
macroName = PrinterUtils::EXPECT_DOUBLE_EQ;
4040
}
4141
}
42+
std::for_each(args.begin(), args.end(), [&type](std::string &arg) {
43+
arg = NameDecorator::decorate(arg);
44+
});
4245
return VerboseAssertsVisitor::FunctionSignature{ macroName, std::move(args) };
4346
}
4447

server/src/visitors/ParametrizedAssertsVisitor.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,7 @@ namespace visitor {
7878
printer->strDeclareVar(
7979
type.typeName(), PrinterUtils::fillVarName(access, PrinterUtils::EXPECTED), value);
8080
}
81-
else {
82-
printer->ss << value << NL;
83-
}
81+
AbstractValueViewVisitor::visitStruct(type, name, view, access, depth);
8482
}
8583

8684
void ParametrizedAssertsVisitor::visitPrimitive(const types::Type &type,

0 commit comments

Comments
 (0)