@@ -1749,29 +1749,34 @@ mod tests {
1749
1749
let project_dir =
1750
1750
TempDir :: new ( "playground" ) . expect ( "Failed to create temporary project directory" ) ;
1751
1751
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) ;
1759
1755
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
+ }
1762
1768
1763
1769
Self { project_dir }
1764
1770
}
1765
1771
}
1766
1772
1767
1773
impl Backend for TestBackend {
1768
1774
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 ( ) ) ;
1772
1776
1773
1777
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) ;
1775
1780
command
1776
1781
}
1777
1782
}
0 commit comments