File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,17 @@ fn main() {
45
45
let mut contents = Vec :: new ( ) ;
46
46
file. read_to_end ( & mut contents) . unwrap ( ) ;
47
47
assert_eq ! ( bytes, contents. as_slice( ) ) ;
48
+ // Test seeking relative to the end of the file.
49
+ file. seek ( SeekFrom :: End ( -1 ) ) . unwrap ( ) ;
50
+ let mut contents = Vec :: new ( ) ;
51
+ file. read_to_end ( & mut contents) . unwrap ( ) ;
52
+ assert_eq ! ( & bytes[ bytes. len( ) - 1 ..] , contents. as_slice( ) ) ;
53
+ // Test seeking relative to the current position.
54
+ file. seek ( SeekFrom :: Start ( 5 ) ) . unwrap ( ) ;
55
+ file. seek ( SeekFrom :: Current ( -3 ) ) . unwrap ( ) ;
56
+ let mut contents = Vec :: new ( ) ;
57
+ file. read_to_end ( & mut contents) . unwrap ( ) ;
58
+ assert_eq ! ( & bytes[ 2 ..] , contents. as_slice( ) ) ;
48
59
49
60
// Test that metadata of an absolute path is correct.
50
61
test_metadata ( bytes, & path) . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments