@@ -8,7 +8,8 @@ extern crate libc;
8
8
9
9
use std:: ffi:: CString ;
10
10
use std:: fs:: {
11
- create_dir, read_dir, remove_dir, remove_dir_all, remove_file, rename, File , OpenOptions ,
11
+ create_dir, read_dir, read_link, remove_dir, remove_dir_all, remove_file, rename, File ,
12
+ OpenOptions ,
12
13
} ;
13
14
use std:: io:: { Error , ErrorKind , Read , Result , Seek , SeekFrom , Write } ;
14
15
use std:: path:: { Path , PathBuf } ;
@@ -317,10 +318,12 @@ fn test_symlink() {
317
318
assert_eq ! ( Error :: last_os_error( ) . kind( ) , ErrorKind :: NotFound ) ;
318
319
}
319
320
320
- // Test that metadata of a symbolic link is correct.
321
+ // Test that metadata of a symbolic link (i.e., the file it points to) is correct.
321
322
check_metadata ( bytes, & symlink_path) . unwrap ( ) ;
322
323
// Test that the metadata of a symbolic link is correct when not following it.
323
324
assert ! ( symlink_path. symlink_metadata( ) . unwrap( ) . file_type( ) . is_symlink( ) ) ;
325
+ // Check that we can follow the link.
326
+ assert_eq ! ( read_link( & symlink_path) . unwrap( ) , path) ;
324
327
// Removing symbolic link should succeed.
325
328
remove_file ( & symlink_path) . unwrap ( ) ;
326
329
0 commit comments