Replace const BASIC_MANIFEST with basic_manifest("foo", "0.0.1")

This commit is contained in:
Dale Wijnand 2018-07-24 18:57:58 +01:00
parent 4e53ce48d1
commit 5659b78b76
No known key found for this signature in database
GPG Key ID: 4F256E3D151DF5EF
3 changed files with 17 additions and 12 deletions

View File

@ -7,7 +7,7 @@ use cargo::util::{process, ProcessBuilder};
use support::{is_nightly, rustc_host, sleep_ms};
use support::paths::{root, CargoPathExt};
use support::ProjectBuilder;
use support::{BASIC_MANIFEST, basic_bin_manifest, execs, main_file, project};
use support::{basic_manifest, basic_bin_manifest, execs, main_file, project};
use support::registry::Package;
use support::ChannelChanger;
use support::hamcrest::{assert_that, existing_dir, existing_file, is_not};
@ -2414,7 +2414,7 @@ fn deletion_causes_failure() {
.build();
assert_that(p.cargo("build"), execs().with_status(0));
p.change_file("Cargo.toml", BASIC_MANIFEST);
p.change_file("Cargo.toml", basic_manifest("foo", "0.0.1"));
assert_that(p.cargo("build"), execs().with_status(101));
}

View File

@ -2,7 +2,7 @@ use std::fs::File;
use std::io::prelude::*;
use support::paths::CargoPathExt;
use support::{BASIC_MANIFEST, execs, project};
use support::{basic_manifest, execs, project};
use support::ChannelChanger;
use support::hamcrest::assert_that;
use support::registry::Package;
@ -151,7 +151,7 @@ failed to select a version for `bar` which could resolve this conflict",
),
);
p.change_file("Cargo.toml", BASIC_MANIFEST);
p.change_file("Cargo.toml", basic_manifest("foo", "0.0.1"));
assert_that(
p.cargo("build").arg("--features").arg("test"),

View File

@ -118,13 +118,6 @@ pub mod paths;
pub mod publish;
pub mod registry;
pub const BASIC_MANIFEST: &str = r#"
[package]
name = "foo"
version = "0.0.1"
authors = []
"#;
/*
*
* ===== Builders =====
@ -265,7 +258,7 @@ impl ProjectBuilder {
let manifest_path = self.root.root().join("Cargo.toml");
if !self.no_manifest && self.files.iter().all(|fb| fb.path != manifest_path) {
self._file(Path::new("Cargo.toml"), BASIC_MANIFEST)
self._file(Path::new("Cargo.toml"), basic_manifest("foo", "0.0.1"))
}
for file in self.files.iter() {
@ -1231,6 +1224,18 @@ impl<T> Tap for T {
}
}
pub fn basic_manifest(name: &str, version: &str) -> String {
format!(
r#"
[package]
name = "{}"
version = "{}"
authors = []
"#,
name, version
)
}
pub fn basic_bin_manifest(name: &str) -> String {
format!(
r#"