File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -1940,3 +1940,41 @@ fn check_host_goes_away() {
1940
1940
) ;
1941
1941
} )
1942
1942
}
1943
+
1944
+ #[ cfg( unix) ]
1945
+ #[ test]
1946
+ fn check_unix_settings_fallback ( ) {
1947
+ setup ( & |config| {
1948
+ // No default toolchain specified yet
1949
+ expect_err (
1950
+ config,
1951
+ & [ "rustup" , "default" ] ,
1952
+ r"no default toolchain configured" ,
1953
+ ) ;
1954
+
1955
+ // Default toolchain specified in fallback settings file
1956
+ let mock_settings_file = config. current_dir ( ) . join ( "mock_fallback_settings.toml" ) ;
1957
+ raw:: write_file (
1958
+ & mock_settings_file,
1959
+ for_host ! ( r"default_toolchain = 'nightly-{0}'" ) ,
1960
+ )
1961
+ . unwrap ( ) ;
1962
+
1963
+ let mut cmd = clitools:: cmd ( config, "rustup" , & [ "default" ] ) ;
1964
+ clitools:: env ( config, & mut cmd) ;
1965
+
1966
+ // Override the path to the fallback settings file to be the mock file
1967
+ cmd. env ( "RUSTUP_OVERRIDE_UNIX_FALLBACK_SETTINGS" , mock_settings_file) ;
1968
+
1969
+ let out = cmd. output ( ) . unwrap ( ) ;
1970
+ assert ! ( out. status. success( ) ) ;
1971
+ let stdout = String :: from_utf8 ( out. stdout ) . unwrap ( ) ;
1972
+ assert_eq ! (
1973
+ & stdout,
1974
+ for_host!(
1975
+ r"nightly-{0} (default)
1976
+ "
1977
+ )
1978
+ ) ;
1979
+ } ) ;
1980
+ }
You can’t perform that action at this time.
0 commit comments