Skip to content

Commit 02c1800

Browse files
committed
tests: update package feature unification tests to use correct unificatin
1 parent 4aeab1c commit 02c1800

File tree

1 file changed

+63
-8
lines changed

1 file changed

+63
-8
lines changed

tests/testsuite/feature_unification.rs

Lines changed: 63 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ fn package_feature_unification() {
131131
".cargo/config.toml",
132132
r#"
133133
[resolver]
134-
feature-unification = "selected"
134+
feature-unification = "package"
135135
"#,
136136
)
137137
.file(
@@ -240,14 +240,21 @@ fn package_feature_unification() {
240240
p.cargo("check -p a -p b")
241241
.arg("-Zfeature-unification")
242242
.masquerade_as_nightly_cargo(&["feature-unification"])
243-
.with_status(101)
244-
.with_stderr_contains("[ERROR] features were unified")
243+
.with_stderr_data(
244+
str![[r#"
245+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
246+
247+
"#]]
248+
.unordered(),
249+
)
245250
.run();
246251
p.cargo("check")
247252
.arg("-Zfeature-unification")
248253
.masquerade_as_nightly_cargo(&["feature-unification"])
249-
.with_status(101)
250-
.with_stderr_contains("[ERROR] features were unified")
254+
.with_stderr_data(str![[r#"
255+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
256+
257+
"#]])
251258
.run();
252259
// Sanity check that compilation without package feature unification does not work
253260
p.cargo("check -p a -p b")
@@ -266,7 +273,7 @@ fn package_feature_unification_default_features() {
266273
".cargo/config.toml",
267274
r#"
268275
[resolver]
269-
feature-unification = "selected"
276+
feature-unification = "package"
270277
"#,
271278
)
272279
.file(
@@ -361,8 +368,13 @@ fn package_feature_unification_default_features() {
361368
p.cargo("check")
362369
.arg("-Zfeature-unification")
363370
.masquerade_as_nightly_cargo(&["feature-unification"])
364-
.with_status(101)
365-
.with_stderr_contains("[ERROR] features were unified")
371+
.with_stderr_data(
372+
str![[r#"
373+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
374+
375+
"#]]
376+
.unordered(),
377+
)
366378
.run();
367379
}
368380

@@ -500,6 +512,34 @@ b v0.1.0 ([ROOT]/foo/b)
500512
501513
common v0.1.0 ([ROOT]/foo/common)
502514
515+
"#]])
516+
.run();
517+
518+
p.cargo("tree -e features")
519+
.arg("-Zfeature-unification")
520+
.masquerade_as_nightly_cargo(&["feature-unification"])
521+
.env("CARGO_RESOLVER_FEATURE_UNIFICATION", "package")
522+
.with_stdout_data(str![[r#"
523+
common v0.1.0 ([ROOT]/foo/common)
524+
a v0.1.0 ([ROOT]/foo/a)
525+
├── common feature "a"
526+
│ └── common v0.1.0 ([ROOT]/foo/common)
527+
├── common feature "default"
528+
│ └── common v0.1.0 ([ROOT]/foo/common)
529+
├── outside feature "a"
530+
│ └── outside v0.1.0
531+
└── outside feature "default"
532+
└── outside v0.1.0
533+
b v0.1.0 ([ROOT]/foo/b)
534+
├── common feature "b"
535+
│ └── common v0.1.0 ([ROOT]/foo/common)
536+
├── common feature "default"
537+
│ └── common v0.1.0 ([ROOT]/foo/common)
538+
├── outside feature "b"
539+
│ └── outside v0.1.0
540+
└── outside feature "default"
541+
└── outside v0.1.0
542+
503543
"#]])
504544
.run();
505545
}
@@ -572,6 +612,20 @@ fn cargo_install_ignores_config() {
572612
[INSTALLED] package `a v0.1.0 ([ROOT]/foo)` (executable `a[EXE]`)
573613
[WARNING] be sure to add `[ROOT]/home/.cargo/bin` to your PATH to be able to run the installed binaries
574614
615+
"#]])
616+
.run();
617+
cargo_process("install --path")
618+
.arg(p.root())
619+
.arg("-Zfeature-unification")
620+
.masquerade_as_nightly_cargo(&["feature-unification"])
621+
.env("CARGO_RESOLVER_FEATURE_UNIFICATION", "package")
622+
.with_stderr_data(str![[r#"
623+
[INSTALLING] a v0.1.0 ([ROOT]/foo)
624+
[FINISHED] `release` profile [optimized] target(s) in [ELAPSED]s
625+
[REPLACING] [ROOT]/home/.cargo/bin/a
626+
[REPLACED] package `a v0.1.0 ([ROOT]/foo)` with `a v0.1.0 ([ROOT]/foo)` (executable `a`)
627+
[WARNING] be sure to add `[ROOT]/home/.cargo/bin` to your PATH to be able to run the installed binaries
628+
575629
"#]])
576630
.run();
577631
}
@@ -620,6 +674,7 @@ edition = "2021"
620674
.build();
621675

622676
p.cargo("fix --edition --allow-no-vcs")
677+
.env("CARGO_RESOLVER_FEATURE_UNIFICATION", "package")
623678
.arg("-Zfeature-unification")
624679
.masquerade_as_nightly_cargo(&["feature-unification"])
625680
.with_stderr_data(str![[r#"

0 commit comments

Comments
 (0)