Skip to content

Commit

Permalink
Auto merge of #7667 - giraffate:add_test_for_name_when_cargo_new, r=a…
Browse files Browse the repository at this point in the history
…lexcrichton

Add test for `NAME` environment variable when `cargo new`

Looks like there was no test for `NAME` environment variable when `cargo new`.
  • Loading branch information
bors committed Dec 6, 2019
2 parents 904c210 + 2fb90ad commit abba15f
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 abba15f

Please sign in to comment.