File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ pub enum AssetServerError {
30
30
}
31
31
32
32
fn format_missing_asset_ext ( exts : & [ String ] ) -> String {
33
- if exts. is_empty ( ) {
33
+ if ! exts. is_empty ( ) {
34
34
format ! (
35
35
" for the following extension{}: {}" ,
36
36
if exts. len( ) > 1 { "s" } else { "" } ,
@@ -572,6 +572,28 @@ mod test {
572
572
)
573
573
}
574
574
575
+ #[ test]
576
+ fn missing_asset_loader_error_messages ( ) {
577
+ assert_eq ! (
578
+ AssetServerError :: MissingAssetLoader { extensions: vec![ ] } . to_string( ) ,
579
+ "no `AssetLoader` found"
580
+ ) ;
581
+ assert_eq ! (
582
+ AssetServerError :: MissingAssetLoader {
583
+ extensions: vec![ "png" . into( ) ]
584
+ }
585
+ . to_string( ) ,
586
+ "no `AssetLoader` found for the following extension: png"
587
+ ) ;
588
+ assert_eq ! (
589
+ AssetServerError :: MissingAssetLoader {
590
+ extensions: vec![ "1.2.png" . into( ) , "2.png" . into( ) , "png" . into( ) ]
591
+ }
592
+ . to_string( ) ,
593
+ "no `AssetLoader` found for the following extensions: 1.2.png, 2.png, png"
594
+ ) ;
595
+ }
596
+
575
597
#[ test]
576
598
fn filename_with_dots ( ) {
577
599
let asset_server = setup ( ) ;
You can’t perform that action at this time.
0 commit comments