diff --git a/test/libsolidity/SemanticTest.cpp b/test/libsolidity/SemanticTest.cpp index eb01764bc..027fcf1a0 100644 --- a/test/libsolidity/SemanticTest.cpp +++ b/test/libsolidity/SemanticTest.cpp @@ -61,10 +61,26 @@ SemanticTest::SemanticTest(string const& _filename, langutil::EVMVersion _evmVer } m_settings.erase("compileViaYul"); } + if (m_settings.count("ABIEncoderV1Only")) + { + if (m_settings["ABIEncoderV1Only"] == "true") + { + m_validatedSettings["ABIEncoderV1Only"] = "true"; + m_runWithABIEncoderV1Only = true; + } + m_settings.erase("ABIEncoderV1Only"); + } parseExpectations(file); soltestAssert(!m_tests.empty(), "No tests specified in " + _filename); } +bool SemanticTest::validateSettings(langutil::EVMVersion _evmVersion) +{ + if (m_runWithABIEncoderV1Only && solidity::test::CommonOptions::get().useABIEncoderV2) + return false; + return EVMVersionRestrictedTestCase::validateSettings(_evmVersion); +} + TestCase::TestResult SemanticTest::run(ostream& _stream, string const& _linePrefix, bool _formatted) { for(bool compileViaYul: set{!m_runWithoutYul, m_runWithYul}) diff --git a/test/libsolidity/SemanticTest.h b/test/libsolidity/SemanticTest.h index 680e03316..5cd8e5cc7 100644 --- a/test/libsolidity/SemanticTest.h +++ b/test/libsolidity/SemanticTest.h @@ -44,6 +44,8 @@ public: explicit SemanticTest(std::string const& _filename, langutil::EVMVersion _evmVersion); + bool validateSettings(langutil::EVMVersion _evmVersion) override; + TestResult run(std::ostream& _stream, std::string const& _linePrefix = "", bool _formatted = false) override; void printSource(std::ostream &_stream, std::string const& _linePrefix = "", bool _formatted = false) const override; void printUpdatedExpectations(std::ostream& _stream, std::string const& _linePrefix = "") const override; @@ -64,6 +66,7 @@ private: std::vector m_tests; bool m_runWithYul = false; bool m_runWithoutYul = true; + bool m_runWithABIEncoderV1Only = false; }; } diff --git a/test/libsolidity/semanticTests/types/mapping_enum_key_getter.sol b/test/libsolidity/semanticTests/types/mapping_enum_key_getter.sol index 42ee8ab17..9b1b23b83 100644 --- a/test/libsolidity/semanticTests/types/mapping_enum_key_getter.sol +++ b/test/libsolidity/semanticTests/types/mapping_enum_key_getter.sol @@ -8,6 +8,8 @@ contract test { return this.table(k); } } +// ==== +// ABIEncoderV1Only: true // ---- // table(uint8): 0 -> 0 // table(uint8): 0x01 -> 0