Skip to content

Commit b66c08c

Browse files
committed
Refactor tests to share output and remove host support
Remove the 'host' test case and optimize test structure by sharing expected output between explicit host target and host-tuple tests. Signed-off-by: Ojus Chugh <ojuschugh@gmail.com>
1 parent 885eb1c commit b66c08c

1 file changed

Lines changed: 19 additions & 14 deletions

File tree

tests/testsuite/metadata.rs

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3842,21 +3842,15 @@ fn filter_platform() {
38423842
.run();
38433843
clear();
38443844

3845-
// Filter on host, removes alt and cfg.
3846-
p.cargo("metadata --filter-platform")
3847-
.arg(&host_target)
3848-
.with_stderr_data(
3849-
str![[r#"
3845+
let host_filtered_stderr = str![[r#"
38503846
[WARNING] please specify `--format-version` flag explicitly to avoid compatibility problems
38513847
[DOWNLOADING] crates ...
38523848
[DOWNLOADED] normal-dep v0.0.1 (registry `dummy-registry`)
38533849
[DOWNLOADED] host-dep v0.0.1 (registry `dummy-registry`)
38543850
3855-
"#]]
3856-
.unordered(),
3857-
)
3858-
.with_stdout_data(
3859-
str![[r#"
3851+
"#]];
3852+
3853+
let host_filtered_stdout = str![[r#"
38603854
{
38613855
"packages": [
38623856
{
@@ -3945,10 +3939,21 @@ fn filter_platform() {
39453939
},
39463940
"...": "{...}"
39473941
}
3948-
"#]]
3949-
.is_json()
3950-
.unordered(),
3951-
)
3942+
"#]];
3943+
3944+
// Filter on host, removes alt and cfg.
3945+
p.cargo("metadata --filter-platform")
3946+
.arg(&host_target)
3947+
.with_stderr_data(host_filtered_stderr.clone().unordered())
3948+
.with_stdout_data(host_filtered_stdout.clone().is_json().unordered())
3949+
.run();
3950+
clear();
3951+
3952+
// Filter on host-tuple, should produce same result as explicit host target.
3953+
p.cargo("metadata --filter-platform")
3954+
.arg("host-tuple")
3955+
.with_stderr_data(host_filtered_stderr.unordered())
3956+
.with_stdout_data(host_filtered_stdout.is_json().unordered())
39523957
.run();
39533958
clear();
39543959

0 commit comments

Comments
 (0)