Skip to content

Commit 0152f26

Browse files
committed
Move .env/.masquerade_as_nightly_cargo to collapse some more p.cargo calls
1 parent 511d4bc commit 0152f26

21 files changed

+118
-201
lines changed

tests/testsuite/alt_registry.rs

Lines changed: 19 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -316,10 +316,9 @@ fn cannot_publish_to_crates_io_with_registry_dependency() {
316316
Package::new("bar", "0.0.1").alternative(true).publish();
317317

318318
assert_that(
319-
p.cargo("publish")
320-
.masquerade_as_nightly_cargo()
321-
.arg("--index")
322-
.arg(registry::registry().to_string()),
319+
p.cargo("publish --index")
320+
.arg(registry::registry().to_string())
321+
.masquerade_as_nightly_cargo(),
323322
execs().with_status(101),
324323
);
325324
}
@@ -349,21 +348,14 @@ fn publish_with_registry_dependency() {
349348

350349
// Login so that we have the token available
351350
assert_that(
352-
p.cargo("login")
353-
.masquerade_as_nightly_cargo()
354-
.arg("--registry")
355-
.arg("alternative")
356-
.arg("TOKEN")
357-
.arg("-Zunstable-options"),
351+
p.cargo("login --registry alternative TOKEN -Zunstable-options")
352+
.masquerade_as_nightly_cargo(),
358353
execs(),
359354
);
360355

361356
assert_that(
362-
p.cargo("publish")
363-
.masquerade_as_nightly_cargo()
364-
.arg("--registry")
365-
.arg("alternative")
366-
.arg("-Zunstable-options"),
357+
p.cargo("publish --registry alternative -Zunstable-options")
358+
.masquerade_as_nightly_cargo(),
367359
execs(),
368360
);
369361
}
@@ -427,11 +419,8 @@ fn block_publish_due_to_no_token() {
427419

428420
// Now perform the actual publish
429421
assert_that(
430-
p.cargo("publish")
431-
.masquerade_as_nightly_cargo()
432-
.arg("--registry")
433-
.arg("alternative")
434-
.arg("-Zunstable-options"),
422+
p.cargo("publish --registry alternative -Zunstable-options")
423+
.masquerade_as_nightly_cargo(),
435424
execs()
436425
.with_status(101)
437426
.with_stderr_contains("error: no upload token found, please run `cargo login`"),
@@ -460,22 +449,15 @@ fn publish_to_alt_registry() {
460449

461450
// Login so that we have the token available
462451
assert_that(
463-
p.cargo("login")
464-
.masquerade_as_nightly_cargo()
465-
.arg("--registry")
466-
.arg("alternative")
467-
.arg("TOKEN")
468-
.arg("-Zunstable-options"),
452+
p.cargo("login --registry alternative TOKEN -Zunstable-options")
453+
.masquerade_as_nightly_cargo(),
469454
execs(),
470455
);
471456

472457
// Now perform the actual publish
473458
assert_that(
474-
p.cargo("publish")
475-
.masquerade_as_nightly_cargo()
476-
.arg("--registry")
477-
.arg("alternative")
478-
.arg("-Zunstable-options"),
459+
p.cargo("publish --registry alternative -Zunstable-options")
460+
.masquerade_as_nightly_cargo(),
479461
execs(),
480462
);
481463

@@ -509,21 +491,14 @@ fn publish_with_crates_io_dep() {
509491

510492
// Login so that we have the token available
511493
assert_that(
512-
p.cargo("login")
513-
.masquerade_as_nightly_cargo()
514-
.arg("--registry")
515-
.arg("alternative")
516-
.arg("TOKEN")
517-
.arg("-Zunstable-options"),
494+
p.cargo("login --registry alternative TOKEN -Zunstable-options")
495+
.masquerade_as_nightly_cargo(),
518496
execs(),
519497
);
520498

521499
assert_that(
522-
p.cargo("publish")
523-
.masquerade_as_nightly_cargo()
524-
.arg("--registry")
525-
.arg("alternative")
526-
.arg("-Zunstable-options"),
500+
p.cargo("publish --registry alternative -Zunstable-options")
501+
.masquerade_as_nightly_cargo(),
527502
execs(),
528503
);
529504
}
@@ -560,11 +535,8 @@ fn credentials_in_url_forbidden() {
560535
.build();
561536

562537
assert_that(
563-
p.cargo("publish")
564-
.masquerade_as_nightly_cargo()
565-
.arg("--registry")
566-
.arg("alternative")
567-
.arg("-Zunstable-options"),
538+
p.cargo("publish --registry alternative -Zunstable-options")
539+
.masquerade_as_nightly_cargo(),
568540
execs()
569541
.with_status(101)
570542
.with_stderr_contains("error: Registry URLs may not contain credentials"),

tests/testsuite/build.rs

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -964,9 +964,8 @@ fn cargo_compile_path_with_offline() {
964964
.build();
965965

966966
assert_that(
967-
p.cargo("build")
968-
.masquerade_as_nightly_cargo()
969-
.arg("-Zoffline"),
967+
p.cargo("build -Zoffline")
968+
.masquerade_as_nightly_cargo(),
970969
execs(),
971970
);
972971
}
@@ -1013,9 +1012,8 @@ fn cargo_compile_with_downloaded_dependency_with_offline() {
10131012
.build();
10141013

10151014
assert_that(
1016-
p2.cargo("build")
1017-
.masquerade_as_nightly_cargo()
1018-
.arg("-Zoffline"),
1015+
p2.cargo("build -Zoffline")
1016+
.masquerade_as_nightly_cargo(),
10191017
execs().with_stderr(
10201018
"\
10211019
[COMPILING] present_dep v1.2.3
@@ -1043,9 +1041,8 @@ fn cargo_compile_offline_not_try_update() {
10431041
.build();
10441042

10451043
assert_that(
1046-
p.cargo("build")
1047-
.masquerade_as_nightly_cargo()
1048-
.arg("-Zoffline"),
1044+
p.cargo("build -Zoffline")
1045+
.masquerade_as_nightly_cargo(),
10491046
execs().with_status(101).with_stderr(
10501047
"\
10511048
error: no matching package named `not_cached_dep` found
@@ -1116,9 +1113,8 @@ fn main(){
11161113
.build();
11171114

11181115
assert_that(
1119-
p2.cargo("run")
1120-
.masquerade_as_nightly_cargo()
1121-
.arg("-Zoffline"),
1116+
p2.cargo("run -Zoffline")
1117+
.masquerade_as_nightly_cargo(),
11221118
execs()
11231119
.with_stderr(format!(
11241120
"\
@@ -1267,9 +1263,8 @@ fn compile_offline_while_transitive_dep_not_cached() {
12671263
drop(File::create(baz_path).ok().unwrap().write_all(&content));
12681264

12691265
assert_that(
1270-
p.cargo("build")
1271-
.masquerade_as_nightly_cargo()
1272-
.arg("-Zoffline"),
1266+
p.cargo("build -Zoffline")
1267+
.masquerade_as_nightly_cargo(),
12731268
execs().with_status(101).with_stderr(
12741269
"\
12751270
error: no matching package named `baz` found
@@ -2918,9 +2913,8 @@ fn rustc_env_var() {
29182913
.build();
29192914

29202915
assert_that(
2921-
p.cargo("build")
2922-
.env("RUSTC", "rustc-that-does-not-exist")
2923-
.arg("-v"),
2916+
p.cargo("build -v")
2917+
.env("RUSTC", "rustc-that-does-not-exist"),
29242918
execs().with_status(101).with_stderr(
29252919
"\
29262920
[ERROR] could not execute process `rustc-that-does-not-exist -vV` ([..])
@@ -4748,9 +4742,8 @@ fn avoid_dev_deps() {
47484742

47494743
assert_that(p.cargo("build"), execs().with_status(101));
47504744
assert_that(
4751-
p.cargo("build")
4752-
.masquerade_as_nightly_cargo()
4753-
.arg("-Zavoid-dev-deps"),
4745+
p.cargo("build -Zavoid-dev-deps")
4746+
.masquerade_as_nightly_cargo(),
47544747
execs(),
47554748
);
47564749
}

tests/testsuite/build_plan.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@ fn cargo_build_plan_simple() {
1010
.build();
1111

1212
assert_that(
13-
p.cargo("build")
14-
.masquerade_as_nightly_cargo()
15-
.arg("--build-plan")
16-
.arg("-Zunstable-options"),
13+
p.cargo("build --build-plan -Zunstable-options")
14+
.masquerade_as_nightly_cargo(),
1715
execs().with_json(
1816
r#"
1917
{
@@ -71,10 +69,8 @@ fn cargo_build_plan_single_dep() {
7169
.file("bar/src/lib.rs", "pub fn bar() {}")
7270
.build();
7371
assert_that(
74-
p.cargo("build")
75-
.masquerade_as_nightly_cargo()
76-
.arg("--build-plan")
77-
.arg("-Zunstable-options"),
72+
p.cargo("build --build-plan -Zunstable-options")
73+
.masquerade_as_nightly_cargo(),
7874
execs().with_json(
7975
r#"
8076
{
@@ -139,10 +135,8 @@ fn cargo_build_plan_build_script() {
139135
.build();
140136

141137
assert_that(
142-
p.cargo("build")
143-
.masquerade_as_nightly_cargo()
144-
.arg("--build-plan")
145-
.arg("-Zunstable-options"),
138+
p.cargo("build --build-plan -Zunstable-options")
139+
.masquerade_as_nightly_cargo(),
146140
execs().with_json(
147141
r#"
148142
{

tests/testsuite/cargo_features.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,16 +280,15 @@ fn z_flags_rejected() {
280280
);
281281

282282
assert_that(
283-
p.cargo("build").masquerade_as_nightly_cargo().arg("-Zarg"),
283+
p.cargo("build -Zarg").masquerade_as_nightly_cargo(),
284284
execs()
285285
.with_status(101)
286286
.with_stderr("error: unknown `-Z` flag specified: arg"),
287287
);
288288

289289
assert_that(
290-
p.cargo("build")
291-
.masquerade_as_nightly_cargo()
292-
.arg("-Zprint-im-a-teapot"),
290+
p.cargo("build -Zprint-im-a-teapot")
291+
.masquerade_as_nightly_cargo(),
293292
execs()
294293
.with_stdout("im-a-teapot = true\n")
295294
.with_stderr(

tests/testsuite/corrupt_git.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ fn deleting_database_files() {
4848
println!("deleting {}", file.display());
4949
cargopaths::remove_file(&file).unwrap();
5050
assert_that(
51-
project.cargo("build").env("RUST_LOG", log).arg("-v"),
51+
project.cargo("build -v").env("RUST_LOG", log),
5252
execs(),
5353
);
5454

@@ -64,7 +64,7 @@ fn deleting_database_files() {
6464
.set_len(2)
6565
.unwrap();
6666
assert_that(
67-
project.cargo("build").env("RUST_LOG", log).arg("-v"),
67+
project.cargo("build -v").env("RUST_LOG", log),
6868
execs(),
6969
);
7070
}
@@ -130,7 +130,7 @@ fn deleting_checkout_files() {
130130
println!("deleting {}", file.display());
131131
cargopaths::remove_file(&file).unwrap();
132132
assert_that(
133-
project.cargo("build").env("RUST_LOG", log).arg("-v"),
133+
project.cargo("build -v").env("RUST_LOG", log),
134134
execs(),
135135
);
136136

@@ -146,7 +146,7 @@ fn deleting_checkout_files() {
146146
.set_len(2)
147147
.unwrap();
148148
assert_that(
149-
project.cargo("build").env("RUST_LOG", log).arg("-v"),
149+
project.cargo("build -v").env("RUST_LOG", log),
150150
execs(),
151151
);
152152
}

tests/testsuite/cross_compile.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ fn simple_cross() {
4747

4848
let target = cross_compile::alternate();
4949
assert_that(
50-
p.cargo("build --target").arg(&target).arg("-v"),
50+
p.cargo("build -v --target").arg(&target),
5151
execs(),
5252
);
5353
assert_that(&p.target_bin(&target, "foo"), existing_file());
@@ -347,7 +347,7 @@ fn plugin_to_the_max() {
347347

348348
let target = cross_compile::alternate();
349349
assert_that(
350-
foo.cargo("build --target").arg(&target).arg("-v"),
350+
foo.cargo("build -v --target").arg(&target),
351351
execs(),
352352
);
353353
println!("second");
@@ -398,7 +398,7 @@ fn linker_and_ar() {
398398
.build();
399399

400400
assert_that(
401-
p.cargo("build --target").arg(&target).arg("-v"),
401+
p.cargo("build -v --target").arg(&target),
402402
execs().with_status(101).with_stderr_contains(&format!(
403403
"\
404404
[COMPILING] foo v0.5.0 ({url})
@@ -715,7 +715,7 @@ fn cross_with_a_build_script() {
715715
.build();
716716

717717
assert_that(
718-
p.cargo("build --target").arg(&target).arg("-v"),
718+
p.cargo("build -v --target").arg(&target),
719719
execs().with_stderr(&format!(
720720
"\
721721
[COMPILING] foo v0.0.0 (file://[..])
@@ -814,7 +814,7 @@ fn build_script_needed_for_host_and_target() {
814814
.build();
815815

816816
assert_that(
817-
p.cargo("build --target").arg(&target).arg("-v"),
817+
p.cargo("build -v --target").arg(&target),
818818
execs()
819819
.with_stderr_contains(&format!(
820820
"[COMPILING] d1 v0.0.0 ({url}/d1)",
@@ -896,7 +896,7 @@ fn build_deps_for_the_right_arch() {
896896

897897
let target = cross_compile::alternate();
898898
assert_that(
899-
p.cargo("build --target").arg(&target).arg("-v"),
899+
p.cargo("build -v --target").arg(&target),
900900
execs(),
901901
);
902902
}
@@ -950,7 +950,7 @@ fn build_script_only_host() {
950950

951951
let target = cross_compile::alternate();
952952
assert_that(
953-
p.cargo("build --target").arg(&target).arg("-v"),
953+
p.cargo("build -v --target").arg(&target),
954954
execs(),
955955
);
956956
}

tests/testsuite/doc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ fn doc_target() {
643643
.build();
644644

645645
assert_that(
646-
p.cargo("doc --target").arg(TARGET).arg("--verbose"),
646+
p.cargo("doc --verbose --target").arg(TARGET),
647647
execs(),
648648
);
649649
assert_that(

tests/testsuite/generate_lockfile.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,8 @@ fn no_index_update() {
9292
);
9393

9494
assert_that(
95-
p.cargo("generate-lockfile")
96-
.masquerade_as_nightly_cargo()
97-
.arg("-Zno-index-update"),
95+
p.cargo("generate-lockfile -Zno-index-update")
96+
.masquerade_as_nightly_cargo(),
9897
execs().with_stdout("").with_stderr(""),
9998
);
10099
}

0 commit comments

Comments
 (0)