Fix Bug in Asset Server Error Message Formatter (#1340)
This commit is contained in:
		
							parent
							
								
									8e69ff2c2b
								
							
						
					
					
						commit
						af67231567
					
				| @ -30,7 +30,7 @@ pub enum AssetServerError { | ||||
| } | ||||
| 
 | ||||
| fn format_missing_asset_ext(exts: &[String]) -> String { | ||||
|     if exts.is_empty() { | ||||
|     if !exts.is_empty() { | ||||
|         format!( | ||||
|             " for the following extension{}: {}", | ||||
|             if exts.len() > 1 { "s" } else { "" }, | ||||
| @ -572,6 +572,28 @@ mod test { | ||||
|         ) | ||||
|     } | ||||
| 
 | ||||
|     #[test] | ||||
|     fn missing_asset_loader_error_messages() { | ||||
|         assert_eq!( | ||||
|             AssetServerError::MissingAssetLoader { extensions: vec![] }.to_string(), | ||||
|             "no `AssetLoader` found" | ||||
|         ); | ||||
|         assert_eq!( | ||||
|             AssetServerError::MissingAssetLoader { | ||||
|                 extensions: vec!["png".into()] | ||||
|             } | ||||
|             .to_string(), | ||||
|             "no `AssetLoader` found for the following extension: png" | ||||
|         ); | ||||
|         assert_eq!( | ||||
|             AssetServerError::MissingAssetLoader { | ||||
|                 extensions: vec!["1.2.png".into(), "2.png".into(), "png".into()] | ||||
|             } | ||||
|             .to_string(), | ||||
|             "no `AssetLoader` found for the following extensions: 1.2.png, 2.png, png" | ||||
|         ); | ||||
|     } | ||||
| 
 | ||||
|     #[test] | ||||
|     fn filename_with_dots() { | ||||
|         let asset_server = setup(); | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Zicklag
						Zicklag