mirror of
https://github.com/rust-lang/cargo
synced 2024-10-14 03:32:39 +00:00
Update tests
This commit is contained in:
parent
623c2d5bad
commit
05cfcb6b8e
|
@ -1630,7 +1630,7 @@ pub fn basic_bin_manifest_with_readme(name: &str, readme_filename: &str) -> Stri
|
|||
name = "{}"
|
||||
version = "0.5.0"
|
||||
authors = ["wycats@example.com"]
|
||||
readme = "{}"
|
||||
readme = {}
|
||||
|
||||
[[bin]]
|
||||
|
||||
|
|
|
@ -118,6 +118,22 @@ fn cargo_read_manifest_cwd() {
|
|||
.run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn cargo_read_manifest_with_specified_readme() {
|
||||
let p = project()
|
||||
.file(
|
||||
"Cargo.toml",
|
||||
&basic_bin_manifest_with_readme("foo", r#""SomeReadme.txt""#),
|
||||
)
|
||||
.file("SomeReadme.txt", "Sample Project")
|
||||
.file("src/foo.rs", &main_file(r#""i am foo""#, &[]))
|
||||
.build();
|
||||
|
||||
p.cargo("read-manifest")
|
||||
.with_json(&manifest_output(&format!(r#""{}""#, "SomeReadme.txt")))
|
||||
.run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn cargo_read_manifest_default_readme() {
|
||||
let readme_filenames = ["README.md", "README.txt", "README"];
|
||||
|
@ -150,3 +166,17 @@ fn cargo_read_manifest_suppress_default_readme() {
|
|||
.with_json(&manifest_output_no_readme())
|
||||
.run();
|
||||
}
|
||||
|
||||
// If a file named README.txt exists, and `readme = true`, the value `README.txt` should be defaulted in.
|
||||
#[cargo_test]
|
||||
fn cargo_read_manifest_defaults_readme_if_true() {
|
||||
let p = project()
|
||||
.file("Cargo.toml", &basic_bin_manifest_with_readme("foo", "true"))
|
||||
.file("README.txt", "Sample project")
|
||||
.file("src/foo.rs", &main_file(r#""i am foo""#, &[]))
|
||||
.build();
|
||||
|
||||
p.cargo("read-manifest")
|
||||
.with_json(&manifest_output(&format!(r#""{}""#, "README.txt")))
|
||||
.run();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue