@@ -866,8 +866,8 @@ fn add_remove_component() {
866
866
#[ test]
867
867
fn which ( ) {
868
868
setup ( & |config| {
869
- let path_1 = config. customdir . join ( "custom-1" ) ;
870
- let path_1 = path_1 . to_string_lossy ( ) ;
869
+ let _path_1 = config. customdir . join ( "custom-1" ) ;
870
+ let path_1 = _path_1 . to_string_lossy ( ) ;
871
871
expect_ok (
872
872
config,
873
873
& [ "rustup" , "toolchain" , "link" , "custom-1" , & path_1] ,
@@ -885,8 +885,8 @@ fn which() {
885
885
& [ "rustup" , "which" , "rustc" ] ,
886
886
"/toolchains/custom-1/bin/rustc" ,
887
887
) ;
888
- let path_2 = config. customdir . join ( "custom-2" ) ;
889
- let path_2 = path_2 . to_string_lossy ( ) ;
888
+ let _path_2 = config. customdir . join ( "custom-2" ) ;
889
+ let path_2 = _path_2 . to_string_lossy ( ) ;
890
890
expect_ok (
891
891
config,
892
892
& [ "rustup" , "toolchain" , "link" , "custom-2" , & path_2] ,
@@ -903,5 +903,54 @@ fn which() {
903
903
& [ "rustup" , "which" , "--toolchain=custom-2" , "rustc" ] ,
904
904
"/toolchains/custom-2/bin/rustc" ,
905
905
) ;
906
+ #[ cfg( windows) ]
907
+ expect_stdout_ok (
908
+ config,
909
+ & [ "rustup" , "--toolchain=custom-2" , "which" , "rustc" ] ,
910
+ "\\ toolchains\\ custom-2\\ bin\\ rustc" ,
911
+ ) ;
912
+ #[ cfg( not( windows) ) ]
913
+ expect_stdout_ok (
914
+ config,
915
+ & [ "rustup" , "--toolchain=custom-2" , "which" , "rustc" ] ,
916
+ "/toolchains/custom-2/bin/rustc" ,
917
+ ) ;
918
+ expect_ok ( config, & [ "rustup" , "default" , "stable" ] ) ;
919
+ #[ cfg( windows) ]
920
+ expect_stdout_ok (
921
+ config,
922
+ & [ "rustup" , "+stable" , "which" , "rustc" ] ,
923
+ "\\ toolchains\\ stable-x86_64-apple-darwin\\ bin\\ rustc" ,
924
+ ) ;
925
+ #[ cfg( not( windows) ) ]
926
+ expect_stdout_ok (
927
+ config,
928
+ & [ "rustup" , "+stable" , "which" , "rustc" ] ,
929
+ "/toolchains/stable-x86_64-apple-darwin/bin/rustc" ,
930
+ ) ;
931
+ expect_ok ( config, & [ "rustup" , "default" , "nightly" ] ) ;
932
+ #[ cfg( windows) ]
933
+ expect_stdout_ok (
934
+ config,
935
+ & [ "rustup" , "+nightly" , "which" , "rustc" ] ,
936
+ "\\ toolchains\\ nightly-x86_64-apple-darwin\\ bin\\ rustc" ,
937
+ ) ;
938
+ #[ cfg( not( windows) ) ]
939
+ expect_stdout_ok (
940
+ config,
941
+ & [ "rustup" , "+nightly" , "which" , "rustc" ] ,
942
+ "/toolchains/nightly-x86_64-apple-darwin/bin/rustc" ,
943
+ ) ;
944
+ expect_err (
945
+ config,
946
+ & [ "rustup" , "+foo" , "which" , "rustc" ] ,
947
+ "error: '+foo' isn't a valid value for '<release-channel>" ,
948
+ ) ;
949
+ expect_stderr_ok (
950
+ config,
951
+ & [ "rustup" , "+nightly" , "which" , "cargo" , "--toolchain=stable" ] ,
952
+ "warning: Both the <release-channel> arg (e.g. \" +nightly\" ) and the \" --toolchain\" option are provided.\n \
953
+ The <release-channel> arg would take precedence over the \" --toolchain\" option.",
954
+ ) ;
906
955
} ) ;
907
956
}
0 commit comments