@@ -772,8 +772,17 @@ fn unavailable_component() {
772
772
)
773
773
. unwrap_err ( ) ;
774
774
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'" ] )
777
786
}
778
787
_ => panic ! ( ) ,
779
788
}
@@ -833,8 +842,17 @@ fn unavailable_component_from_profile() {
833
842
)
834
843
. unwrap_err ( ) ;
835
844
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'" ] )
838
856
}
839
857
_ => panic ! ( ) ,
840
858
}
@@ -913,8 +931,17 @@ fn removed_component() {
913
931
)
914
932
. unwrap_err ( ) ;
915
933
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'" ] )
918
945
}
919
946
_ => panic ! ( ) ,
920
947
}
@@ -992,13 +1019,24 @@ fn unavailable_components_is_target() {
992
1019
)
993
1020
. unwrap_err ( ) ;
994
1021
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
+ ) ;
1002
1040
}
1003
1041
_ => panic ! ( ) ,
1004
1042
}
@@ -1071,13 +1109,23 @@ fn unavailable_components_with_same_target() {
1071
1109
)
1072
1110
. unwrap_err ( ) ;
1073
1111
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
+ ) ;
1081
1129
}
1082
1130
_ => panic ! ( ) ,
1083
1131
}
0 commit comments