Skip to content

Commit

Permalink
Add test for NAME environment variable when cargo new
Browse files Browse the repository at this point in the history
  • Loading branch information
giraffate committed Dec 6, 2019
1 parent 0e186bf commit 2fb90ad
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/testsuite/new.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,23 @@ fn finds_author_username() {
assert!(contents.contains(r#"authors = ["foo"]"#));
}

#[cargo_test]
fn finds_author_name() {
create_empty_gitconfig();
cargo_process("new foo")
.env_remove("USERNAME")
.env("NAME", "foo")
.run();

let toml = paths::root().join("foo/Cargo.toml");
let mut contents = String::new();
File::open(&toml)
.unwrap()
.read_to_string(&mut contents)
.unwrap();
assert!(contents.contains(r#"authors = ["foo"]"#));
}

#[cargo_test]
fn finds_author_priority() {
cargo_process("new foo")
Expand Down

0 comments on commit 2fb90ad

Please sign in to comment.