Skip to content

Commit fcf6fdc

Browse files
committed
tests: update package feature unification tests to use correct unificatin
1 parent 30e4c51 commit fcf6fdc

File tree

1 file changed

+87
-8
lines changed

1 file changed

+87
-8
lines changed

tests/testsuite/feature_unification.rs

Lines changed: 87 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

@@ -442,6 +454,30 @@ fn package_feature_unification_weak_dependencies() {
442454
.file("b/src/lib.rs", "pub use common::b;")
443455
.build();
444456

457+
p.cargo("check -p a -p b")
458+
.arg("-Zfeature-unification")
459+
.masquerade_as_nightly_cargo(&["feature-unification"])
460+
.with_stderr_data(
461+
str![[r#"
462+
[CHECKING] common v0.1.0 ([ROOT]/foo/common)
463+
[CHECKING] a v0.1.0 ([ROOT]/foo/a)
464+
[CHECKING] b v0.1.0 ([ROOT]/foo/b)
465+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
466+
467+
"#]]
468+
.unordered(),
469+
)
470+
.run();
471+
p.cargo("check")
472+
.arg("-Zfeature-unification")
473+
.masquerade_as_nightly_cargo(&["feature-unification"])
474+
.with_stderr_data(str![[r#"
475+
[CHECKING] common v0.1.0 ([ROOT]/foo/common)
476+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
477+
478+
"#]])
479+
.run();
480+
445481
// Sanity check that compilation without package feature unification does not work
446482
p.cargo("check -p a -p b")
447483
.arg("-Zfeature-unification")
@@ -586,6 +622,34 @@ b v0.1.0 ([ROOT]/foo/b)
586622
587623
common v0.1.0 ([ROOT]/foo/common)
588624
625+
"#]])
626+
.run();
627+
628+
p.cargo("tree -e features")
629+
.arg("-Zfeature-unification")
630+
.masquerade_as_nightly_cargo(&["feature-unification"])
631+
.env("CARGO_RESOLVER_FEATURE_UNIFICATION", "package")
632+
.with_stdout_data(str![[r#"
633+
common v0.1.0 ([ROOT]/foo/common)
634+
a v0.1.0 ([ROOT]/foo/a)
635+
├── common feature "a"
636+
│ └── common v0.1.0 ([ROOT]/foo/common)
637+
├── common feature "default"
638+
│ └── common v0.1.0 ([ROOT]/foo/common)
639+
├── outside feature "a"
640+
│ └── outside v0.1.0
641+
└── outside feature "default"
642+
└── outside v0.1.0
643+
b v0.1.0 ([ROOT]/foo/b)
644+
├── common feature "b"
645+
│ └── common v0.1.0 ([ROOT]/foo/common)
646+
├── common feature "default"
647+
│ └── common v0.1.0 ([ROOT]/foo/common)
648+
├── outside feature "b"
649+
│ └── outside v0.1.0
650+
└── outside feature "default"
651+
└── outside v0.1.0
652+
589653
"#]])
590654
.run();
591655
}
@@ -658,6 +722,20 @@ fn cargo_install_ignores_config() {
658722
[INSTALLED] package `a v0.1.0 ([ROOT]/foo)` (executable `a[EXE]`)
659723
[WARNING] be sure to add `[ROOT]/home/.cargo/bin` to your PATH to be able to run the installed binaries
660724
725+
"#]])
726+
.run();
727+
cargo_process("install --path")
728+
.arg(p.root())
729+
.arg("-Zfeature-unification")
730+
.masquerade_as_nightly_cargo(&["feature-unification"])
731+
.env("CARGO_RESOLVER_FEATURE_UNIFICATION", "package")
732+
.with_stderr_data(str![[r#"
733+
[INSTALLING] a v0.1.0 ([ROOT]/foo)
734+
[FINISHED] `release` profile [optimized] target(s) in [ELAPSED]s
735+
[REPLACING] [ROOT]/home/.cargo/bin/a
736+
[REPLACED] package `a v0.1.0 ([ROOT]/foo)` with `a v0.1.0 ([ROOT]/foo)` (executable `a`)
737+
[WARNING] be sure to add `[ROOT]/home/.cargo/bin` to your PATH to be able to run the installed binaries
738+
661739
"#]])
662740
.run();
663741
}
@@ -706,6 +784,7 @@ edition = "2021"
706784
.build();
707785

708786
p.cargo("fix --edition --allow-no-vcs")
787+
.env("CARGO_RESOLVER_FEATURE_UNIFICATION", "package")
709788
.arg("-Zfeature-unification")
710789
.masquerade_as_nightly_cargo(&["feature-unification"])
711790
.with_stderr_data(str![[r#"

0 commit comments

Comments
 (0)