File tree Expand file tree Collapse file tree 2 files changed +52
-0
lines changed
tests/testsuite/cargo_add Expand file tree Collapse file tree 2 files changed +52
-0
lines changed Original file line number Diff line number Diff line change @@ -145,6 +145,7 @@ mod script_bare;
145145mod script_frontmatter;
146146mod script_shebang;
147147mod sorted_table_with_dotted_item;
148+ mod symlink;
148149mod target;
149150mod target_cfg;
150151mod unknown_inherited_feature;
Original file line number Diff line number Diff line change 1+ use cargo_test_support:: prelude:: * ;
2+ use cargo_test_support:: project;
3+ use cargo_test_support:: registry;
4+ use std:: fs;
5+
6+ #[ cargo_test]
7+ fn symlink_case ( ) {
8+ if !cargo_test_support:: symlink_supported ( ) {
9+ return ;
10+ }
11+
12+ registry:: init ( ) ;
13+ registry:: Package :: new ( "test-dep" , "1.0.0" ) . publish ( ) ;
14+
15+ let project = project ( ) . file ( "src/lib.rs" , "" ) . build ( ) ;
16+
17+ let target_dir = project. root ( ) . join ( "target_dir" ) ;
18+ fs:: create_dir_all ( & target_dir) . unwrap ( ) ;
19+
20+ fs:: copy (
21+ project. root ( ) . join ( "Cargo.toml" ) ,
22+ target_dir. join ( "Cargo.toml" ) ,
23+ )
24+ . unwrap ( ) ;
25+
26+ fs:: remove_file ( project. root ( ) . join ( "Cargo.toml" ) ) . unwrap ( ) ;
27+
28+ #[ cfg( unix) ]
29+ {
30+ use std:: os:: unix:: fs:: symlink;
31+ symlink (
32+ target_dir. join ( "Cargo.toml" ) ,
33+ project. root ( ) . join ( "Cargo.toml" ) ,
34+ )
35+ . unwrap ( ) ;
36+ }
37+
38+ #[ cfg( windows) ]
39+ {
40+ use std:: os:: windows:: fs:: symlink_file;
41+ symlink_file (
42+ target_dir. join ( "Cargo.toml" ) ,
43+ project. root ( ) . join ( "Cargo.toml" ) ,
44+ )
45+ . unwrap ( ) ;
46+ }
47+
48+ project. cargo ( "add test-dep" ) . run ( ) ;
49+
50+ assert ! ( project. root( ) . join( "Cargo.toml" ) . is_symlink( ) ) ;
51+ }
You can’t perform that action at this time.
0 commit comments