Do not insert SPDX line if it is already present (in semantic tests)

This commit is contained in:
Alex Beregszaszi
2020-12-14 14:25:58 +00:00
parent 3a7a0e4256
commit 34cab95446
2 changed files with 7 additions and 3 deletions
+4 -2
View File
@@ -51,9 +51,11 @@ AnalysisFramework::parseAnalyseAndReturnError(
)
{
compiler().reset();
// Do not insert license if it is already present.
bool insertLicense = _insertLicenseAndVersionPragma && _source.find("// SPDX-License-Identifier:") == string::npos;
compiler().setSources({{"",
_insertLicenseAndVersionPragma ?
"pragma solidity >=0.0;\n// SPDX-License-Identifier: GPL-3.0\n" + _source :
string{_insertLicenseAndVersionPragma ? "pragma solidity >=0.0;\n" : ""} +
string{insertLicense ? "// SPDX-License-Identifier: GPL-3.0\n" : ""} +
_source
}});
compiler().setEVMVersion(solidity::test::CommonOptions::get().evmVersion());