Skip to content

Commit

Permalink
UTBot don't decorate struct field [BUG] #465 (#470)
Browse files Browse the repository at this point in the history
* UTBot don't decorate struct field [BUG] #465
  • Loading branch information
alexey-utkin authored Sep 23, 2022
1 parent 80106dd commit 1dd46ac
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions server/src/NameDecorator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const std::unordered_set<std::string> NameDecorator::CPP_KEYWORDS = {
"explicit",
"export",
"extern",
"false",
// "false",
"float",
"for",
"friend",
Expand Down Expand Up @@ -115,7 +115,7 @@ const std::unordered_set<std::string> NameDecorator::CPP_KEYWORDS = {
"this",
"thread_local",
"throw",
"true",
// "true",
"try",
"typedef",
"typeid",
Expand Down
2 changes: 1 addition & 1 deletion server/src/Tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ namespace tests {
if (structInfo.fields[i].name.empty())
return "";

std::string prefix = "." + structInfo.fields[i].name + " = ";
std::string prefix = "." + NameDecorator::decorate(structInfo.fields[i].name) + " = ";
if (structInfo.isCLike) {
return prefix;
}
Expand Down
3 changes: 3 additions & 0 deletions server/src/visitors/AssertsVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ namespace visitor {
macroName = PrinterUtils::EXPECT_DOUBLE_EQ;
}
}
std::for_each(args.begin(), args.end(), [&type](std::string &arg) {
arg = NameDecorator::decorate(arg);
});
return VerboseAssertsVisitor::FunctionSignature{ macroName, std::move(args) };
}

Expand Down
4 changes: 1 addition & 3 deletions server/src/visitors/ParametrizedAssertsVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,7 @@ namespace visitor {
printer->strDeclareVar(
type.typeName(), PrinterUtils::fillVarName(access, PrinterUtils::EXPECTED), value);
}
else {
printer->ss << value << NL;
}
AbstractValueViewVisitor::visitStruct(type, name, view, access, depth);
}

void ParametrizedAssertsVisitor::visitPrimitive(const types::Type &type,
Expand Down

0 comments on commit 1dd46ac

Please sign in to comment.