File tree 1 file changed +35
-0
lines changed
1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -190,6 +190,11 @@ fn make_config_symlink_to_config_toml_absolute() {
190
190
t ! ( symlink_file( & toml_path, & symlink_path) ) ;
191
191
}
192
192
193
+ fn make_config_symlink_to_config_toml_relative ( ) {
194
+ let symlink_path = paths:: root ( ) . join ( ".cargo/config" ) ;
195
+ t ! ( symlink_file( Path :: new( "config.toml" ) , & symlink_path) ) ;
196
+ }
197
+
193
198
#[ track_caller]
194
199
pub fn assert_error < E : Borrow < anyhow:: Error > > ( error : E , msgs : & str ) {
195
200
let causes = error
@@ -309,6 +314,36 @@ f1 = 1
309
314
assert_match ( "" , & output) ;
310
315
}
311
316
317
+ #[ cargo_test]
318
+ fn config_ambiguous_filename_symlink_doesnt_warn_relative ( ) {
319
+ // Windows requires special permissions to create symlinks.
320
+ // If we don't have permission, just skip this test.
321
+ if !symlink_supported ( ) {
322
+ return ;
323
+ } ;
324
+
325
+ write_config_toml (
326
+ "\
327
+ [foo]
328
+ f1 = 1
329
+ " ,
330
+ ) ;
331
+
332
+ make_config_symlink_to_config_toml_relative ( ) ;
333
+
334
+ let gctx = new_gctx ( ) ;
335
+
336
+ assert_eq ! ( gctx. get:: <Option <i32 >>( "foo.f1" ) . unwrap( ) , Some ( 1 ) ) ;
337
+
338
+ // It should NOT have warned for the symlink.
339
+ // But, currently it does!
340
+ let output = read_output ( gctx) ;
341
+ let expected = "\
342
+ [WARNING] both `[..]/.cargo/config` and `[..]/.cargo/config.toml` exist. Using `[..]/.cargo/config`
343
+ " ;
344
+ assert_match ( expected, & output) ;
345
+ }
346
+
312
347
#[ cargo_test]
313
348
fn config_ambiguous_filename ( ) {
314
349
write_config_extless (
You can’t perform that action at this time.
0 commit comments