mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	Allow tests to be marked ABIEncoderV1Only.
This commit is contained in:
		
							parent
							
								
									af9fc8b634
								
							
						
					
					
						commit
						d882b6fa83
					
				| @ -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<bool>{!m_runWithoutYul, m_runWithYul}) | ||||
|  | ||||
| @ -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<TestFunctionCall> m_tests; | ||||
| 	bool m_runWithYul = false; | ||||
| 	bool m_runWithoutYul = true; | ||||
| 	bool m_runWithABIEncoderV1Only = false; | ||||
| }; | ||||
| 
 | ||||
| } | ||||
|  | ||||
| @ -8,6 +8,8 @@ contract test { | ||||
|         return this.table(k); | ||||
|     } | ||||
| } | ||||
| // ==== | ||||
| // ABIEncoderV1Only: true | ||||
| // ---- | ||||
| // table(uint8): 0 -> 0 | ||||
| // table(uint8): 0x01 -> 0 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user