test: Add test for issue-14560

This commit is contained in:
Lin Yihai 2024-09-23 09:27:32 +08:00
parent cf781daeb7
commit d5cb6b532f

View File

@ -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.