mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	test: add a test about explicitly converting a string literal to string
This commit is contained in:
		
							parent
							
								
									e136ec8704
								
							
						
					
					
						commit
						df5d5edd1b
					
				| @ -1,3 +1,8 @@ | ||||
| ### 0.4.7 (unreleased) | ||||
| 
 | ||||
| Bugfixes: | ||||
|  * Type checker: string literals that are not valid UTF-8 cannot be converted to string type | ||||
| 
 | ||||
| ### 0.4.6 (2016-11-22) | ||||
| 
 | ||||
| Bugfixes: | ||||
|  | ||||
| @ -2038,7 +2038,7 @@ BOOST_AUTO_TEST_CASE(string) | ||||
| 	BOOST_CHECK_NO_THROW(parseAndAnalyse(sourceCode)); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(invalid_utf8) | ||||
| BOOST_AUTO_TEST_CASE(invalid_utf8_implicit) | ||||
| { | ||||
| 	char const* sourceCode = R"( | ||||
| 		contract C { | ||||
| @ -2048,6 +2048,16 @@ BOOST_AUTO_TEST_CASE(invalid_utf8) | ||||
| 	CHECK_ERROR(sourceCode, TypeError, "invalid UTF-8"); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(invalid_utf8_explicit) | ||||
| { | ||||
| 	char const* sourceCode = R"( | ||||
| 		contract C { | ||||
| 			string s = string("\xa0\x00"); | ||||
| 		} | ||||
| 	)"; | ||||
| 	CHECK_ERROR(sourceCode, TypeError, "Explicit type conversion not allowed"); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(string_index) | ||||
| { | ||||
| 	char const* sourceCode = R"( | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user