@@ -68,6 +68,12 @@ SemanticTest::SemanticTest(string const& _filename, langutil::EVMVersion _evmVer
68
68
m_builtins[" smoke_test1" ] = simpleSmokeBuiltin;
69
69
m_builtins[" smoke_test2" ] = simpleSmokeBuiltin;
70
70
71
+ m_hooks.emplace_back ([](FunctionCall const & _call) -> std::vector<std::string> {
72
+ if (_call.signature .find (" smoke_" ) != string::npos)
73
+ return {_call.signature };
74
+ return {};
75
+ });
76
+
71
77
string choice = m_reader.stringSetting (" compileViaYul" , " default" );
72
78
if (choice == " also" )
73
79
{
@@ -140,6 +146,15 @@ TestCase::TestResult SemanticTest::run(ostream& _stream, string const& _linePref
140
146
return result;
141
147
}
142
148
149
+ vector<string> SemanticTest::effectsOfCall (FunctionCall const & _call) const
150
+ {
151
+ vector<string> effects;
152
+ for (auto const & hook: m_hooks)
153
+ for (auto const & effect: hook (_call))
154
+ effects.emplace_back (effect);
155
+ return effects;
156
+ }
157
+
143
158
TestCase::TestResult SemanticTest::runTest (
144
159
ostream& _stream,
145
160
string const & _linePrefix,
@@ -266,6 +281,8 @@ TestCase::TestResult SemanticTest::runTest(
266
281
test.setRawBytes (std::move (output));
267
282
test.setContractABI (m_compiler.contractABI (m_compiler.lastContractName ()));
268
283
}
284
+
285
+ success &= test.call ().effects == effectsOfCall (test.call ());
269
286
}
270
287
271
288
if (!m_runWithYul && _compileViaYul)
@@ -286,15 +303,15 @@ TestCase::TestResult SemanticTest::runTest(
286
303
for (TestFunctionCall const & test: m_tests)
287
304
{
288
305
ErrorReporter errorReporter;
289
- _stream << test.format (errorReporter, _linePrefix, false , _formatted) << endl;
306
+ _stream << test.format (errorReporter, _linePrefix, false , _formatted, effectsOfCall (test. call ()) ) << endl;
290
307
_stream << errorReporter.format (_linePrefix, _formatted);
291
308
}
292
309
_stream << endl;
293
310
AnsiColorized (_stream, _formatted, {BOLD, CYAN}) << _linePrefix << " Obtained result:" << endl;
294
311
for (TestFunctionCall const & test: m_tests)
295
312
{
296
313
ErrorReporter errorReporter;
297
- _stream << test.format (errorReporter, _linePrefix, true , _formatted) << endl;
314
+ _stream << test.format (errorReporter, _linePrefix, true , _formatted, effectsOfCall (test. call ()) ) << endl;
298
315
_stream << errorReporter.format (_linePrefix, _formatted);
299
316
}
300
317
AnsiColorized (_stream, _formatted, {BOLD, RED})
@@ -363,7 +380,7 @@ void SemanticTest::printSource(ostream& _stream, string const& _linePrefix, bool
363
380
void SemanticTest::printUpdatedExpectations (ostream& _stream, string const &) const
364
381
{
365
382
for (TestFunctionCall const & test: m_tests)
366
- _stream << test.format (" " , true , false ) << endl;
383
+ _stream << test.format (" " , true , false , effectsOfCall (test. call ()) ) << endl;
367
384
}
368
385
369
386
void SemanticTest::printUpdatedSettings (ostream& _stream, string const & _linePrefix)
0 commit comments