Update tests

This commit is contained in:
Tarun Verghis 2020-05-28 22:07:12 -07:00
parent 623c2d5bad
commit 05cfcb6b8e
2 changed files with 31 additions and 1 deletions

View file

@ -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]]

View file

@ -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();
}