From 2fb90adc7361dc407eaf09866376d9a2764029d8 Mon Sep 17 00:00:00 2001 From: Takayuki Nakata Date: Fri, 6 Dec 2019 09:30:13 +0900 Subject: [PATCH] Add test for `NAME` environment variable when `cargo new` --- tests/testsuite/new.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/testsuite/new.rs b/tests/testsuite/new.rs index 874e2f7a7b6..367aa44c451 100644 --- a/tests/testsuite/new.rs +++ b/tests/testsuite/new.rs @@ -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")