Skip to content

Commit cb9c0b0

Browse files
committed
Auto merge of #5787 - dwijnand:dedup-manifest-further, r=alexcrichton
Deduplicate a bunch more manifests in test code Wanted to deduplicate the "bar" manifest files too, and found I hadn't even done build.rs.
2 parents 4e53ce4 + ab19c48 commit cb9c0b0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+450
-3675
lines changed

tests/testsuite/alt_registry.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use support::ChannelChanger;
22
use support::registry::{self, alt_api_path, Package};
3-
use support::{execs, paths, project};
3+
use support::{basic_manifest, execs, paths, project};
44
use support::hamcrest::assert_that;
55
use std::fs::File;
66
use std::io::Write;
@@ -249,15 +249,7 @@ fn registry_and_path_dep_works() {
249249
"#,
250250
)
251251
.file("src/main.rs", "fn main() {}")
252-
.file(
253-
"bar/Cargo.toml",
254-
r#"
255-
[project]
256-
name = "bar"
257-
version = "0.0.1"
258-
authors = []
259-
"#,
260-
)
252+
.file("bar/Cargo.toml", &basic_manifest("bar", "0.0.1"))
261253
.file("bar/src/lib.rs", "")
262254
.build();
263255

tests/testsuite/bad_config.rs

Lines changed: 6 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use support::{execs, project};
1+
use support::{basic_manifest, execs, project};
22
use support::registry::Package;
33
use support::hamcrest::assert_that;
44

@@ -598,30 +598,14 @@ Caused by:
598598
#[test]
599599
fn duplicate_deps() {
600600
let p = project()
601-
.file(
602-
"shim-bar/Cargo.toml",
603-
r#"
604-
[package]
605-
name = "bar"
606-
version = "0.0.1"
607-
authors = []
608-
"#,
609-
)
601+
.file("shim-bar/Cargo.toml", &basic_manifest("bar", "0.0.1"))
610602
.file(
611603
"shim-bar/src/lib.rs",
612604
r#"
613605
pub fn a() {}
614606
"#,
615607
)
616-
.file(
617-
"linux-bar/Cargo.toml",
618-
r#"
619-
[package]
620-
name = "bar"
621-
version = "0.0.1"
622-
authors = []
623-
"#,
624-
)
608+
.file("linux-bar/Cargo.toml", &basic_manifest("bar", "0.0.1"))
625609
.file(
626610
"linux-bar/src/lib.rs",
627611
r#"
@@ -663,30 +647,14 @@ have a single canonical source path irrespective of build target.
663647
#[test]
664648
fn duplicate_deps_diff_sources() {
665649
let p = project()
666-
.file(
667-
"shim-bar/Cargo.toml",
668-
r#"
669-
[package]
670-
name = "bar"
671-
version = "0.0.1"
672-
authors = []
673-
"#,
674-
)
650+
.file("shim-bar/Cargo.toml", &basic_manifest("bar", "0.0.1"))
675651
.file(
676652
"shim-bar/src/lib.rs",
677653
r#"
678654
pub fn a() {}
679655
"#,
680656
)
681-
.file(
682-
"linux-bar/Cargo.toml",
683-
r#"
684-
[package]
685-
name = "bar"
686-
version = "0.0.1"
687-
authors = []
688-
"#,
689-
)
657+
.file("linux-bar/Cargo.toml", &basic_manifest("bar", "0.0.1"))
690658
.file(
691659
"linux-bar/src/lib.rs",
692660
r#"
@@ -828,14 +796,7 @@ fn unused_keys_in_virtual_manifest() {
828796
bulid = "foo"
829797
"#,
830798
)
831-
.file(
832-
"bar/Cargo.toml",
833-
r#"
834-
[project]
835-
version = "0.0.1"
836-
name = "bar"
837-
"#,
838-
)
799+
.file("bar/Cargo.toml", &basic_manifest("bar", "0.0.1"))
839800
.file("bar/src/lib.rs", r"")
840801
.build();
841802
assert_that(

tests/testsuite/bench.rs

Lines changed: 9 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::str;
33
use cargo::util::process;
44
use support::{is_nightly, ChannelChanger};
55
use support::paths::CargoPathExt;
6-
use support::{basic_bin_manifest, basic_lib_manifest, execs, project};
6+
use support::{basic_manifest, basic_bin_manifest, basic_lib_manifest, execs, project};
77
use support::hamcrest::{assert_that, existing_file};
88

99
#[test]
@@ -876,15 +876,7 @@ fn lib_with_standard_name() {
876876
}
877877

878878
let p = project()
879-
.file(
880-
"Cargo.toml",
881-
r#"
882-
[package]
883-
name = "syntax"
884-
version = "0.0.1"
885-
authors = []
886-
"#,
887-
)
879+
.file("Cargo.toml", &basic_manifest("syntax", "0.0.1"))
888880
.file(
889881
"src/lib.rs",
890882
"
@@ -1509,14 +1501,7 @@ fn bench_all_workspace() {
15091501
fn bench_foo(_: &mut Bencher) -> () { () }
15101502
"#,
15111503
)
1512-
.file(
1513-
"bar/Cargo.toml",
1514-
r#"
1515-
[project]
1516-
name = "bar"
1517-
version = "0.1.0"
1518-
"#,
1519-
)
1504+
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
15201505
.file(
15211506
"bar/src/lib.rs",
15221507
r#"
@@ -1572,14 +1557,7 @@ fn bench_all_exclude() {
15721557
fn main() {}
15731558
"#,
15741559
)
1575-
.file(
1576-
"bar/Cargo.toml",
1577-
r#"
1578-
[project]
1579-
name = "bar"
1580-
version = "0.1.0"
1581-
"#,
1582-
)
1560+
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
15831561
.file(
15841562
"bar/src/lib.rs",
15851563
r#"
@@ -1593,14 +1571,7 @@ fn bench_all_exclude() {
15931571
}
15941572
"#,
15951573
)
1596-
.file(
1597-
"baz/Cargo.toml",
1598-
r#"
1599-
[project]
1600-
name = "baz"
1601-
version = "0.1.0"
1602-
"#,
1603-
)
1574+
.file("baz/Cargo.toml", &basic_manifest("baz", "0.1.0"))
16041575
.file(
16051576
"baz/src/lib.rs",
16061577
r#"
@@ -1636,14 +1607,7 @@ fn bench_all_virtual_manifest() {
16361607
members = ["bar", "baz"]
16371608
"#,
16381609
)
1639-
.file(
1640-
"bar/Cargo.toml",
1641-
r#"
1642-
[project]
1643-
name = "bar"
1644-
version = "0.1.0"
1645-
"#,
1646-
)
1610+
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
16471611
.file(
16481612
"bar/src/lib.rs",
16491613
r#"
@@ -1662,14 +1626,7 @@ fn bench_all_virtual_manifest() {
16621626
fn bench_bar(_: &mut Bencher) -> () { () }
16631627
"#,
16641628
)
1665-
.file(
1666-
"baz/Cargo.toml",
1667-
r#"
1668-
[project]
1669-
name = "baz"
1670-
version = "0.1.0"
1671-
"#,
1672-
)
1629+
.file("baz/Cargo.toml", &basic_manifest("baz", "0.1.0"))
16731630
.file(
16741631
"baz/src/lib.rs",
16751632
r#"
@@ -1765,14 +1722,7 @@ fn bench_virtual_manifest_all_implied() {
17651722
members = ["bar", "baz"]
17661723
"#,
17671724
)
1768-
.file(
1769-
"bar/Cargo.toml",
1770-
r#"
1771-
[project]
1772-
name = "bar"
1773-
version = "0.1.0"
1774-
"#,
1775-
)
1725+
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
17761726
.file(
17771727
"bar/src/lib.rs",
17781728
r#"
@@ -1789,14 +1739,7 @@ fn bench_virtual_manifest_all_implied() {
17891739
fn bench_bar(_: &mut Bencher) -> () { () }
17901740
"#,
17911741
)
1792-
.file(
1793-
"baz/Cargo.toml",
1794-
r#"
1795-
[project]
1796-
name = "baz"
1797-
version = "0.1.0"
1798-
"#,
1799-
)
1742+
.file("baz/Cargo.toml", &basic_manifest("baz", "0.1.0"))
18001743
.file(
18011744
"baz/src/lib.rs",
18021745
r#"

0 commit comments

Comments
 (0)