Skip to content

Commit 05cfcb6

Browse files
committed
Update tests
1 parent 623c2d5 commit 05cfcb6

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

crates/cargo-test-support/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1630,7 +1630,7 @@ pub fn basic_bin_manifest_with_readme(name: &str, readme_filename: &str) -> Stri
16301630
name = "{}"
16311631
version = "0.5.0"
16321632
authors = ["wycats@example.com"]
1633-
readme = "{}"
1633+
readme = {}
16341634
16351635
[[bin]]
16361636

tests/testsuite/read_manifest.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,22 @@ fn cargo_read_manifest_cwd() {
118118
.run();
119119
}
120120

121+
#[cargo_test]
122+
fn cargo_read_manifest_with_specified_readme() {
123+
let p = project()
124+
.file(
125+
"Cargo.toml",
126+
&basic_bin_manifest_with_readme("foo", r#""SomeReadme.txt""#),
127+
)
128+
.file("SomeReadme.txt", "Sample Project")
129+
.file("src/foo.rs", &main_file(r#""i am foo""#, &[]))
130+
.build();
131+
132+
p.cargo("read-manifest")
133+
.with_json(&manifest_output(&format!(r#""{}""#, "SomeReadme.txt")))
134+
.run();
135+
}
136+
121137
#[cargo_test]
122138
fn cargo_read_manifest_default_readme() {
123139
let readme_filenames = ["README.md", "README.txt", "README"];
@@ -150,3 +166,17 @@ fn cargo_read_manifest_suppress_default_readme() {
150166
.with_json(&manifest_output_no_readme())
151167
.run();
152168
}
169+
170+
// If a file named README.txt exists, and `readme = true`, the value `README.txt` should be defaulted in.
171+
#[cargo_test]
172+
fn cargo_read_manifest_defaults_readme_if_true() {
173+
let p = project()
174+
.file("Cargo.toml", &basic_bin_manifest_with_readme("foo", "true"))
175+
.file("README.txt", "Sample project")
176+
.file("src/foo.rs", &main_file(r#""i am foo""#, &[]))
177+
.build();
178+
179+
p.cargo("read-manifest")
180+
.with_json(&manifest_output(&format!(r#""{}""#, "README.txt")))
181+
.run();
182+
}

0 commit comments

Comments
 (0)