@@ -772,8 +772,17 @@ fn unavailable_component() {
772772 )
773773 . unwrap_err ( ) ;
774774 match err. downcast :: < RustupError > ( ) {
775- Ok ( e @ RustupError :: RequestedComponentsUnavailable { .. } ) => {
776- assert ! ( e. to_string( ) . contains( "rustup component remove --toolchain nightly --target x86_64-apple-darwin bonus" ) ) ;
775+ Ok ( RustupError :: RequestedComponentsUnavailable {
776+ components,
777+ manifest,
778+ toolchain,
779+ } ) => {
780+ assert_eq ! ( toolchain, "nightly" ) ;
781+ let descriptions = components
782+ . iter ( )
783+ . map ( |c| c. description ( & manifest) )
784+ . collect :: < Vec < _ > > ( ) ;
785+ assert_eq ! ( descriptions, [ "'bonus' for target 'x86_64-apple-darwin'" ] )
777786 }
778787 _ => panic ! ( ) ,
779788 }
@@ -833,8 +842,17 @@ fn unavailable_component_from_profile() {
833842 )
834843 . unwrap_err ( ) ;
835844 match err. downcast :: < RustupError > ( ) {
836- Ok ( e @ RustupError :: RequestedComponentsUnavailable { .. } ) => {
837- assert ! ( e. to_string( ) . contains( "rustup component remove --toolchain nightly --target x86_64-apple-darwin rustc" ) ) ;
845+ Ok ( RustupError :: RequestedComponentsUnavailable {
846+ components,
847+ manifest,
848+ toolchain,
849+ } ) => {
850+ assert_eq ! ( toolchain, "nightly" ) ;
851+ let descriptions = components
852+ . iter ( )
853+ . map ( |c| c. description ( & manifest) )
854+ . collect :: < Vec < _ > > ( ) ;
855+ assert_eq ! ( descriptions, [ "'rustc' for target 'x86_64-apple-darwin'" ] )
838856 }
839857 _ => panic ! ( ) ,
840858 }
@@ -913,8 +931,17 @@ fn removed_component() {
913931 )
914932 . unwrap_err ( ) ;
915933 match err. downcast :: < RustupError > ( ) {
916- Ok ( e @ RustupError :: RequestedComponentsUnavailable { .. } ) => {
917- assert ! ( e. to_string( ) . contains( "rustup component remove --toolchain nightly --target x86_64-apple-darwin bonus" ) ) ;
934+ Ok ( RustupError :: RequestedComponentsUnavailable {
935+ components,
936+ manifest,
937+ toolchain,
938+ } ) => {
939+ assert_eq ! ( toolchain, "nightly" ) ;
940+ let descriptions = components
941+ . iter ( )
942+ . map ( |c| c. description ( & manifest) )
943+ . collect :: < Vec < _ > > ( ) ;
944+ assert_eq ! ( descriptions, [ "'bonus' for target 'x86_64-apple-darwin'" ] )
918945 }
919946 _ => panic ! ( ) ,
920947 }
@@ -992,13 +1019,24 @@ fn unavailable_components_is_target() {
9921019 )
9931020 . unwrap_err ( ) ;
9941021 match err. downcast :: < RustupError > ( ) {
995- Ok ( e @ RustupError :: RequestedComponentsUnavailable { .. } ) => {
996- let err_str = e. to_string ( ) ;
997- assert ! ( err_str
998- . contains( "rustup target remove --toolchain nightly i686-apple-darwin" ) ) ;
999- assert ! ( err_str. contains(
1000- "rustup target remove --toolchain nightly i686-unknown-linux-gnu"
1001- ) ) ;
1022+ Ok ( RustupError :: RequestedComponentsUnavailable {
1023+ components,
1024+ manifest,
1025+ toolchain,
1026+ } ) => {
1027+ assert_eq ! ( toolchain, "nightly" ) ;
1028+ let descriptions = components
1029+ . iter ( )
1030+ . map ( |c| c. description ( & manifest) )
1031+ . collect :: < Vec < _ > > ( ) ;
1032+ assert_eq ! (
1033+ descriptions,
1034+ [
1035+ "'rust-std' for target 'x86_64-apple-darwin'" ,
1036+ "'rust-std' for target 'i686-apple-darwin'" ,
1037+ "'rust-std' for target 'i686-unknown-linux-gnu'"
1038+ ]
1039+ ) ;
10021040 }
10031041 _ => panic ! ( ) ,
10041042 }
@@ -1071,13 +1109,23 @@ fn unavailable_components_with_same_target() {
10711109 )
10721110 . unwrap_err ( ) ;
10731111 match err. downcast :: < RustupError > ( ) {
1074- Ok ( e @ RustupError :: RequestedComponentsUnavailable { .. } ) => {
1075- let err_str = e. to_string ( ) ;
1076- assert ! ( err_str
1077- . contains( "rustup target remove --toolchain nightly x86_64-apple-darwin" ) ) ;
1078- assert ! ( err_str. contains(
1079- "rustup component remove --toolchain nightly --target x86_64-apple-darwin rustc"
1080- ) ) ;
1112+ Ok ( RustupError :: RequestedComponentsUnavailable {
1113+ components,
1114+ manifest,
1115+ toolchain,
1116+ } ) => {
1117+ assert_eq ! ( toolchain, "nightly" ) ;
1118+ let descriptions = components
1119+ . iter ( )
1120+ . map ( |c| c. description ( & manifest) )
1121+ . collect :: < Vec < _ > > ( ) ;
1122+ assert_eq ! (
1123+ descriptions,
1124+ [
1125+ "'rustc' for target 'x86_64-apple-darwin'" ,
1126+ "'rust-std' for target 'x86_64-apple-darwin'"
1127+ ]
1128+ ) ;
10811129 }
10821130 _ => panic ! ( ) ,
10831131 }
0 commit comments