-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generalize helpers for indenting and prefixing #14517
Conversation
test/libsolidity/GasTest.cpp
Outdated
void GasTest::printSource(ostream& _stream, string const& _linePrefix, bool) const | ||
{ | ||
string line; | ||
istringstream input(m_source); | ||
while (getline(input, line)) | ||
_stream << _linePrefix << line << std::endl; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is superfluous. The inherited version from TestCase
does the same thing.
e52a836
to
78212c1
Compare
78212c1
to
ed2ce61
Compare
6645e92
to
bef39cd
Compare
bef39cd
to
58a765a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
58a765a
to
b56e26a
Compare
/// @param _trimPrefix If true, the function avoids introducing trailing whitespace on empty lines. | ||
/// This is achieved by removing trailing spaces from the prefix on such lines. | ||
/// Note that tabs and newlines are not removed, only spaces are. | ||
/// @param _finalNewline If true, an extra \n will be printed at the end of @a _input if it does |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// @param _finalNewline If true, an extra \n will be printed at the end of @a _input if it does | |
/// @param _finalNewline If true, an extra \n will be printed at the end of @_input if it does |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What? Is this even a correct doxygen syntax? I think that @
must be followed by a command name.
Well, not that we're following this strictly, but still, this seems incorrect.
/// such lines containing trailing whitespace. | ||
inline std::string indent(std::string const& _input, bool _indentEmptyLines = false) | ||
{ | ||
return prefixLines(_input, " ", !_indentEmptyLines); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return prefixLines(_input, " ", !_indentEmptyLines); | |
return prefixLines(_input, std::string(4, ' '), !_indentEmptyLines); |
I think it's clearer this way, at least with regards to the number of spaces in the indentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't mind either way, but the PR is merged now so I'll leave it as is (the comment was posted while the PR was already on automerge and I did not notice it in time).
Another refactor related to #14433.
This one comes from the fact that at one point I needed a function to indent a chunk of output and I found several, neither of them accessible to me.
In the end I changed the way expectations are formatted and did not need that function (which is why #14506 does not depend on this refactor) but since I already cleaned this up, I think we should still merge it.