@@ -4,7 +4,7 @@ use cargo::core::compiler::RustDocFingerprint;
4
4
use cargo_test_support:: paths:: CargoPathExt ;
5
5
use cargo_test_support:: registry:: Package ;
6
6
use 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 } ;
8
8
use std:: fs;
9
9
use std:: str;
10
10
@@ -1250,7 +1250,6 @@ fn doc_all_member_dependency_same_name() {
1250
1250
}
1251
1251
1252
1252
#[ cargo_test]
1253
- #[ cfg( not( windows) ) ] // `echo` may not be available
1254
1253
fn doc_workspace_open_help_message ( ) {
1255
1254
let p = project ( )
1256
1255
. file (
@@ -1268,15 +1267,14 @@ fn doc_workspace_open_help_message() {
1268
1267
1269
1268
// The order in which bar is compiled or documented is not deterministic
1270
1269
p. cargo ( "doc --workspace --open" )
1271
- . env ( "BROWSER" , " echo" )
1270
+ . env ( "BROWSER" , tools :: echo ( ) )
1272
1271
. with_stderr_contains ( "[..] Documenting bar v0.1.0 ([..])" )
1273
1272
. with_stderr_contains ( "[..] Documenting foo v0.1.0 ([..])" )
1274
1273
. with_stderr_contains ( "[..] Opening [..]/bar/index.html" )
1275
1274
. run ( ) ;
1276
1275
}
1277
1276
1278
1277
#[ cargo_test]
1279
- #[ cfg( not( windows) ) ] // `echo` may not be available
1280
1278
fn doc_extern_map_local ( ) {
1281
1279
if !is_nightly ( ) {
1282
1280
// -Zextern-html-root-url is unstable
@@ -1297,7 +1295,7 @@ fn doc_extern_map_local() {
1297
1295
. build ( ) ;
1298
1296
1299
1297
p. cargo ( "doc -v --no-deps -Zrustdoc-map --open" )
1300
- . env ( "BROWSER" , " echo" )
1298
+ . env ( "BROWSER" , tools :: echo ( ) )
1301
1299
. masquerade_as_nightly_cargo ( )
1302
1300
. with_stderr (
1303
1301
"\
@@ -1311,7 +1309,6 @@ fn doc_extern_map_local() {
1311
1309
}
1312
1310
1313
1311
#[ cargo_test]
1314
- #[ cfg( not( windows) ) ] // `echo` may not be available
1315
1312
fn doc_workspace_open_different_library_and_package_names ( ) {
1316
1313
let p = project ( )
1317
1314
. file (
@@ -1335,29 +1332,31 @@ fn doc_workspace_open_different_library_and_package_names() {
1335
1332
. build ( ) ;
1336
1333
1337
1334
p. cargo ( "doc --open" )
1338
- . env ( "BROWSER" , " echo" )
1335
+ . env ( "BROWSER" , tools :: echo ( ) )
1339
1336
. with_stderr_contains ( "[..] Documenting foo v0.1.0 ([..])" )
1340
1337
. with_stderr_contains ( "[..] [CWD]/target/doc/foolib/index.html" )
1341
1338
. with_stdout_contains ( "[CWD]/target/doc/foolib/index.html" )
1342
1339
. run ( ) ;
1343
1340
1344
1341
p. change_file (
1345
1342
".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
+ ) ,
1350
1350
) ;
1351
1351
1352
1352
// check that the cargo config overrides the browser env var
1353
1353
p. cargo ( "doc --open" )
1354
- . env ( "BROWSER" , "true " )
1354
+ . env ( "BROWSER" , "do_not_run_me " )
1355
1355
. with_stdout_contains ( "a [CWD]/target/doc/foolib/index.html" )
1356
1356
. run ( ) ;
1357
1357
}
1358
1358
1359
1359
#[ cargo_test]
1360
- #[ cfg( not( windows) ) ] // `echo` may not be available
1361
1360
fn doc_workspace_open_binary ( ) {
1362
1361
let p = project ( )
1363
1362
. file (
@@ -1382,14 +1381,13 @@ fn doc_workspace_open_binary() {
1382
1381
. build ( ) ;
1383
1382
1384
1383
p. cargo ( "doc --open" )
1385
- . env ( "BROWSER" , " echo" )
1384
+ . env ( "BROWSER" , tools :: echo ( ) )
1386
1385
. with_stderr_contains ( "[..] Documenting foo v0.1.0 ([..])" )
1387
1386
. with_stderr_contains ( "[..] Opening [CWD]/target/doc/foobin/index.html" )
1388
1387
. run ( ) ;
1389
1388
}
1390
1389
1391
1390
#[ cargo_test]
1392
- #[ cfg( not( windows) ) ] // `echo` may not be available
1393
1391
fn doc_workspace_open_binary_and_library ( ) {
1394
1392
let p = project ( )
1395
1393
. file (
@@ -1417,7 +1415,7 @@ fn doc_workspace_open_binary_and_library() {
1417
1415
. build ( ) ;
1418
1416
1419
1417
p. cargo ( "doc --open" )
1420
- . env ( "BROWSER" , " echo" )
1418
+ . env ( "BROWSER" , tools :: echo ( ) )
1421
1419
. with_stderr_contains ( "[..] Documenting foo v0.1.0 ([..])" )
1422
1420
. with_stderr_contains ( "[..] Opening [CWD]/target/doc/foolib/index.html" )
1423
1421
. run ( ) ;
0 commit comments