From d5cb6b532f0bd3d2e4c8bc2302ea8db4473a2499 Mon Sep 17 00:00:00 2001 From: Lin Yihai Date: Mon, 23 Sep 2024 09:27:32 +0800 Subject: [PATCH] test: Add test for issue-14560 --- tests/testsuite/config.rs | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/tests/testsuite/config.rs b/tests/testsuite/config.rs index 6d0a3ff8e..2582670a7 100644 --- a/tests/testsuite/config.rs +++ b/tests/testsuite/config.rs @@ -16,7 +16,7 @@ use cargo::CargoResult; use cargo_test_support::compare::assert_e2e; use cargo_test_support::prelude::*; use cargo_test_support::str; -use cargo_test_support::{paths, project, symlink_supported, t}; +use cargo_test_support::{paths, project, project_in_home, symlink_supported, t}; use cargo_util_schemas::manifest::TomlTrimPaths; use cargo_util_schemas::manifest::TomlTrimPathsValue; use cargo_util_schemas::manifest::{self as cargo_toml, TomlDebugInfo, VecStringOrBool as VSOB}; @@ -299,6 +299,28 @@ f1 = 1 assert_e2e().eq(&output, expected); } +#[cargo_test] +fn home_config_works_without_extension() { + write_config_at( + paths::cargo_home().join("config"), + "\ +[foo] +f1 = 1 +", + ); + let p = project_in_home("foo").file("src/lib.rs", "").build(); + + p.cargo("-vV") + .with_stderr_data(str![[r#" +[WARNING] `[ROOT]/home/.cargo/config` is deprecated in favor of `config.toml` +[NOTE] if you need to support cargo 1.38 or earlier, you can symlink `config` to `config.toml` +[WARNING] `[ROOT]/home/.cargo/config` is deprecated in favor of `config.toml` +[NOTE] if you need to support cargo 1.38 or earlier, you can symlink `config` to `config.toml` + +"#]]) + .run(); +} + #[cargo_test] fn config_ambiguous_filename_symlink_doesnt_warn() { // Windows requires special permissions to create symlinks.