mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	Add a test for a struct accessor.
This commit is contained in:
		
							parent
							
								
									754a992500
								
							
						
					
					
						commit
						1c3a64026b
					
				| @ -6812,6 +6812,32 @@ BOOST_AUTO_TEST_CASE(skip_dynamic_types) | ||||
| 	BOOST_CHECK(callContractFunction("g()") == encodeArgs(u256(7), u256(8))); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(skip_dynamic_types_for_structs) | ||||
| { | ||||
| 	// For accessors, the dynamic types are already removed in the external signature itself.
 | ||||
| 	char const* sourceCode = R"( | ||||
| 		contract C { | ||||
| 			struct S { | ||||
| 				uint x; | ||||
| 				string a; // this is present in the accessor
 | ||||
| 				uint[] b; // this is not present
 | ||||
| 				uint y; | ||||
| 			} | ||||
| 			S public s; | ||||
| 			function g() returns (uint, uint) { | ||||
| 				s.x = 2; | ||||
| 				s.a = "abc"; | ||||
| 				s.b = [7, 8, 9]; | ||||
| 				s.y = 6; | ||||
| 				var (x, a, y) = this.s(); | ||||
| 				return (x, y); | ||||
| 			} | ||||
| 		} | ||||
| 	)"; | ||||
| 	compileAndRun(sourceCode, 0, "C"); | ||||
| 	BOOST_CHECK(callContractFunction("g()") == encodeArgs(u256(2), u256(6))); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_SUITE_END() | ||||
| 
 | ||||
| } | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user