File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -931,4 +931,27 @@ mod tests {
931
931
assert ! ( symlink_path. exists( ) ) ;
932
932
assert ! ( dir_path. exists( ) ) ;
933
933
}
934
+
935
+ #[ test]
936
+ #[ cfg( windows) ]
937
+ fn test_remove_symlink_file ( ) {
938
+ use super :: * ;
939
+ use std:: fs;
940
+ use std:: os:: windows:: fs:: symlink_file;
941
+
942
+ let tmpdir = tempfile:: tempdir ( ) . unwrap ( ) ;
943
+ let file_path = tmpdir. path ( ) . join ( "testfile" ) ;
944
+ let symlink_path = tmpdir. path ( ) . join ( "symlink" ) ;
945
+
946
+ fs:: write ( & file_path, b"test" ) . unwrap ( ) ;
947
+
948
+ symlink_file ( & file_path, & symlink_path) . expect ( "failed to create symlink" ) ;
949
+
950
+ assert ! ( symlink_path. exists( ) ) ;
951
+
952
+ assert ! ( remove_file( symlink_path. clone( ) ) . is_ok( ) ) ;
953
+
954
+ assert ! ( !symlink_path. exists( ) ) ;
955
+ assert ! ( file_path. exists( ) ) ;
956
+ }
934
957
}
You can’t perform that action at this time.
0 commit comments