We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent eda35e1 commit 636ad62Copy full SHA for 636ad62
tests/run-pass/fs.rs
@@ -41,8 +41,14 @@ fn main() {
41
// Reading until EOF should get the whole text.
42
file.read_to_end(&mut contents).unwrap();
43
assert_eq!(bytes, contents.as_slice());
44
- // Cloning a file should be successful
45
- file.try_clone().unwrap();
+
+ // Cloning a file should be successful.
46
+ let file = File::open(&path).unwrap();
47
+ let mut cloned = file.try_clone().unwrap();
48
+ // Reading from a cloned file should get the same text.
49
+ let mut contents = Vec::new();
50
+ cloned.read_to_end(&mut contents).unwrap();
51
+ assert_eq!(bytes, contents.as_slice());
52
53
// Test that seeking to the beginning and reading until EOF gets the text again.
54
file.seek(SeekFrom::Start(0)).unwrap();
0 commit comments