Take into account multi-line license comments when adding preamble in test frameworks

This commit is contained in:
Kamil Śliwak 2023-08-04 18:48:15 +02:00
parent 69e5b634ea
commit 0c2fce579a
2 changed files with 2 additions and 2 deletions

View File

@ -52,7 +52,7 @@ AnalysisFramework::parseAnalyseAndReturnError(
{
compiler().reset();
// Do not insert license if it is already present.
bool insertLicense = _insertLicenseAndVersionPragma && _source.find("// SPDX-License-Identifier:") == string::npos;
bool insertLicense = _insertLicenseAndVersionPragma && _source.find("SPDX-License-Identifier:") == string::npos;
compiler().setSources({{"",
string{_insertLicenseAndVersionPragma ? "pragma solidity >=0.0;\n" : ""} +
string{insertLicense ? "// SPDX-License-Identifier: GPL-3.0\n" : ""} +

View File

@ -146,7 +146,7 @@ string SolidityExecutionFramework::addPreamble(string const& _sourceCode)
{
// Silence compiler version warning
string preamble = "pragma solidity >=0.0;\n";
if (_sourceCode.find("// SPDX-License-Identifier:") == string::npos)
if (_sourceCode.find("SPDX-License-Identifier:") == string::npos)
preamble += "// SPDX-License-Identifier: unlicensed\n";
if (
solidity::test::CommonOptions::get().useABIEncoderV1 &&