Skip to content

Commit 54965fb

Browse files
andy53nikola-matic
andcommitted
fix emit statments being printed on the same line
Update test/libsolidity/semanticTests/emit_three_identical_events.sol Co-authored-by: Kamil Śliwak <[email protected]> Update test/libsolidity/semanticTests/emit_two_identical_events.sol Co-authored-by: Nikola Matić <[email protected]>
1 parent 84cdcec commit 54965fb

File tree

3 files changed

+30
-6
lines changed

3 files changed

+30
-6
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
contract C {
2+
event Terminated();
3+
4+
function terminate() external {
5+
emit Terminated();
6+
emit Terminated();
7+
emit Terminated();
8+
}
9+
}
10+
// ----
11+
// terminate() ->
12+
// ~ emit Terminated()
13+
// ~ emit Terminated()
14+
// ~ emit Terminated()
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
contract C {
2+
event Terminated();
3+
4+
function terminate() external {
5+
emit Terminated();
6+
emit Terminated();
7+
}
8+
}
9+
// ----
10+
// terminate() ->
11+
// ~ emit Terminated()
12+
// ~ emit Terminated()

test/libsolidity/util/TestFunctionCall.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,10 @@ string TestFunctionCall::format(
208208
if (!sideEffects.empty())
209209
{
210210
stream << std::endl;
211-
for (string const& effect: sideEffects)
212-
{
213-
stream << _linePrefix << "// ~ " << effect;
214-
if (effect != *sideEffects.rbegin())
215-
stream << std::endl;
216-
}
211+
size_t i = 0;
212+
for (; i < sideEffects.size() - 1; ++i)
213+
stream << _linePrefix << "// ~ " << sideEffects[i] << std::endl;
214+
stream << _linePrefix << "// ~ " << sideEffects[i];
217215
}
218216

219217
stream << formatGasExpectations(_linePrefix, _renderMode == RenderMode::ExpectedValuesActualGas, _interactivePrint);

0 commit comments

Comments
 (0)