Skip to content

Commit abba15f

Browse files
committed
Auto merge of #7667 - giraffate:add_test_for_name_when_cargo_new, r=alexcrichton
Add test for `NAME` environment variable when `cargo new` Looks like there was no test for `NAME` environment variable when `cargo new`.
2 parents 904c210 + 2fb90ad commit abba15f

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/testsuite/new.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,23 @@ fn finds_author_username() {
212212
assert!(contents.contains(r#"authors = ["foo"]"#));
213213
}
214214

215+
#[cargo_test]
216+
fn finds_author_name() {
217+
create_empty_gitconfig();
218+
cargo_process("new foo")
219+
.env_remove("USERNAME")
220+
.env("NAME", "foo")
221+
.run();
222+
223+
let toml = paths::root().join("foo/Cargo.toml");
224+
let mut contents = String::new();
225+
File::open(&toml)
226+
.unwrap()
227+
.read_to_string(&mut contents)
228+
.unwrap();
229+
assert!(contents.contains(r#"authors = ["foo"]"#));
230+
}
231+
215232
#[cargo_test]
216233
fn finds_author_priority() {
217234
cargo_process("new foo")

0 commit comments

Comments
 (0)