Allow overwriting the release flag for tests and adjust test suite to CBOR metadata.

This commit is contained in:
Daniel Kirchner
2019-05-08 22:21:50 +02:00
parent e121c8f3c7
commit a6a28ac475
18 changed files with 156 additions and 187 deletions
+1 -1
View File
@@ -1177,7 +1177,7 @@ bytes CompilerStack::createCBORMetadata(string const& _metadata, bool _experimen
encoder.pushBytes("bzzr0", dev::swarmHash(_metadata).asBytes());
if (_experimentalMode)
encoder.pushBool("experimental", true);
if (VersionIsRelease)
if (m_release)
encoder.pushBytes("solc", VersionCompactBytes);
else
encoder.pushString("solc", VersionStringStrict);
+5 -1
View File
@@ -25,6 +25,7 @@
#include <libsolidity/interface/ReadFile.h>
#include <libsolidity/interface/OptimiserSettings.h>
#include <libsolidity/interface/Version.h>
#include <liblangutil/ErrorReporter.h>
#include <liblangutil/EVMVersion.h>
@@ -261,6 +262,8 @@ public:
/// @returns a JSON representing the estimated gas usage for contract creation, internal and external functions
Json::Value gasEstimates(std::string const& _contractName) const;
/// Overwrites the release/prerelease flag. Should only be used for testing.
void overwriteReleaseFlag(bool release) { m_release = release; }
private:
/// The state per source unit. Filled gradually during parsing.
struct Source
@@ -333,7 +336,7 @@ private:
std::string createMetadata(Contract const& _contract) const;
/// @returns the metadata CBOR for the given serialised metadata JSON.
static bytes createCBORMetadata(std::string const& _metadata, bool _experimentalMode);
bytes createCBORMetadata(std::string const& _metadata, bool _experimentalMode);
/// @returns the computer source mapping string.
std::string computeSourceMapping(eth::AssemblyItems const& _items) const;
@@ -382,6 +385,7 @@ private:
langutil::ErrorReporter m_errorReporter;
bool m_metadataLiteralSources = false;
State m_stackState = Empty;
bool m_release = VersionIsRelease;
};
}