@@ -4,7 +4,7 @@ use cargo::core::compiler::RustDocFingerprint;
44use cargo_test_support:: paths:: CargoPathExt ;
55use cargo_test_support:: registry:: Package ;
66use cargo_test_support:: { basic_lib_manifest, basic_manifest, git, project} ;
7- use cargo_test_support:: { is_nightly, rustc_host, symlink_supported} ;
7+ use cargo_test_support:: { is_nightly, rustc_host, symlink_supported, tools } ;
88use std:: fs;
99use std:: str;
1010
@@ -1250,7 +1250,6 @@ fn doc_all_member_dependency_same_name() {
12501250}
12511251
12521252#[ cargo_test]
1253- #[ cfg( not( windows) ) ] // `echo` may not be available
12541253fn doc_workspace_open_help_message ( ) {
12551254 let p = project ( )
12561255 . file (
@@ -1268,15 +1267,14 @@ fn doc_workspace_open_help_message() {
12681267
12691268 // The order in which bar is compiled or documented is not deterministic
12701269 p. cargo ( "doc --workspace --open" )
1271- . env ( "BROWSER" , " echo" )
1270+ . env ( "BROWSER" , tools :: echo ( ) )
12721271 . with_stderr_contains ( "[..] Documenting bar v0.1.0 ([..])" )
12731272 . with_stderr_contains ( "[..] Documenting foo v0.1.0 ([..])" )
12741273 . with_stderr_contains ( "[..] Opening [..]/bar/index.html" )
12751274 . run ( ) ;
12761275}
12771276
12781277#[ cargo_test]
1279- #[ cfg( not( windows) ) ] // `echo` may not be available
12801278fn doc_extern_map_local ( ) {
12811279 if !is_nightly ( ) {
12821280 // -Zextern-html-root-url is unstable
@@ -1297,7 +1295,7 @@ fn doc_extern_map_local() {
12971295 . build ( ) ;
12981296
12991297 p. cargo ( "doc -v --no-deps -Zrustdoc-map --open" )
1300- . env ( "BROWSER" , " echo" )
1298+ . env ( "BROWSER" , tools :: echo ( ) )
13011299 . masquerade_as_nightly_cargo ( )
13021300 . with_stderr (
13031301 "\
@@ -1311,7 +1309,6 @@ fn doc_extern_map_local() {
13111309}
13121310
13131311#[ cargo_test]
1314- #[ cfg( not( windows) ) ] // `echo` may not be available
13151312fn doc_workspace_open_different_library_and_package_names ( ) {
13161313 let p = project ( )
13171314 . file (
@@ -1335,29 +1332,31 @@ fn doc_workspace_open_different_library_and_package_names() {
13351332 . build ( ) ;
13361333
13371334 p. cargo ( "doc --open" )
1338- . env ( "BROWSER" , " echo" )
1335+ . env ( "BROWSER" , tools :: echo ( ) )
13391336 . with_stderr_contains ( "[..] Documenting foo v0.1.0 ([..])" )
13401337 . with_stderr_contains ( "[..] [CWD]/target/doc/foolib/index.html" )
13411338 . with_stdout_contains ( "[CWD]/target/doc/foolib/index.html" )
13421339 . run ( ) ;
13431340
13441341 p. change_file (
13451342 ".cargo/config.toml" ,
1346- r#"
1347- [doc]
1348- browser = ["echo", "a"]
1349- "# ,
1343+ & format ! (
1344+ r#"
1345+ [doc]
1346+ browser = ["{}", "a"]
1347+ "# ,
1348+ tools:: echo( ) . display( ) . to_string( ) . replace( '\\' , "\\ \\ " )
1349+ ) ,
13501350 ) ;
13511351
13521352 // check that the cargo config overrides the browser env var
13531353 p. cargo ( "doc --open" )
1354- . env ( "BROWSER" , "true " )
1354+ . env ( "BROWSER" , "do_not_run_me " )
13551355 . with_stdout_contains ( "a [CWD]/target/doc/foolib/index.html" )
13561356 . run ( ) ;
13571357}
13581358
13591359#[ cargo_test]
1360- #[ cfg( not( windows) ) ] // `echo` may not be available
13611360fn doc_workspace_open_binary ( ) {
13621361 let p = project ( )
13631362 . file (
@@ -1382,14 +1381,13 @@ fn doc_workspace_open_binary() {
13821381 . build ( ) ;
13831382
13841383 p. cargo ( "doc --open" )
1385- . env ( "BROWSER" , " echo" )
1384+ . env ( "BROWSER" , tools :: echo ( ) )
13861385 . with_stderr_contains ( "[..] Documenting foo v0.1.0 ([..])" )
13871386 . with_stderr_contains ( "[..] Opening [CWD]/target/doc/foobin/index.html" )
13881387 . run ( ) ;
13891388}
13901389
13911390#[ cargo_test]
1392- #[ cfg( not( windows) ) ] // `echo` may not be available
13931391fn doc_workspace_open_binary_and_library ( ) {
13941392 let p = project ( )
13951393 . file (
@@ -1417,7 +1415,7 @@ fn doc_workspace_open_binary_and_library() {
14171415 . build ( ) ;
14181416
14191417 p. cargo ( "doc --open" )
1420- . env ( "BROWSER" , " echo" )
1418+ . env ( "BROWSER" , tools :: echo ( ) )
14211419 . with_stderr_contains ( "[..] Documenting foo v0.1.0 ([..])" )
14221420 . with_stderr_contains ( "[..] Opening [CWD]/target/doc/foolib/index.html" )
14231421 . run ( ) ;
0 commit comments