@@ -1749,29 +1749,34 @@ mod tests {
17491749 let project_dir =
17501750 TempDir :: new ( "playground" ) . expect ( "Failed to create temporary project directory" ) ;
17511751
1752- let output = std:: process:: Command :: new ( "cargo" )
1753- . arg ( "init" )
1754- . args ( [ "--name" , "playground" ] )
1755- . arg ( project_dir. path ( ) )
1756- . output ( )
1757- . expect ( "Build failed" ) ;
1758- assert ! ( output. status. success( ) , "Cargo initialization failed" ) ;
1752+ for channel in Channel :: ALL {
1753+ let channel = channel. to_str ( ) ;
1754+ let channel_dir = project_dir. path ( ) . join ( channel) ;
17591755
1760- let main = project_dir. path ( ) . join ( "src" ) . join ( "main.rs" ) ;
1761- std:: fs:: remove_file ( main) . expect ( "Could not delete main.rs" ) ;
1756+ let output = std:: process:: Command :: new ( "cargo" )
1757+ . arg ( format ! ( "+{channel}" ) )
1758+ . arg ( "new" )
1759+ . args ( [ "--name" , "playground" ] )
1760+ . arg ( & channel_dir)
1761+ . output ( )
1762+ . expect ( "Cargo new failed" ) ;
1763+ assert ! ( output. status. success( ) , "Cargo new failed" ) ;
1764+
1765+ let main = channel_dir. join ( "src" ) . join ( "main.rs" ) ;
1766+ std:: fs:: remove_file ( main) . expect ( "Could not delete main.rs" ) ;
1767+ }
17621768
17631769 Self { project_dir }
17641770 }
17651771 }
17661772
17671773 impl Backend for TestBackend {
17681774 fn prepare_worker_command ( & self , channel : Channel ) -> Command {
1769- let toolchain_file = format ! ( r#"[toolchain]\nchannel = "{}""# , channel. to_str( ) ) ;
1770- let path = self . project_dir . path ( ) . join ( "rust-toolchain.toml" ) ;
1771- std:: fs:: write ( path, toolchain_file) . expect ( "Couldn't write toolchain file" ) ;
1775+ let channel_dir = self . project_dir . path ( ) . join ( channel. to_str ( ) ) ;
17721776
17731777 let mut command = Command :: new ( "./target/debug/worker" ) ;
1774- command. arg ( self . project_dir . path ( ) ) ;
1778+ command. env ( "RUSTUP_TOOLCHAIN" , channel. to_str ( ) ) ;
1779+ command. arg ( channel_dir) ;
17751780 command
17761781 }
17771782 }
0 commit comments